Tools, FAQ, Tutorials:
Testing If a Variable Is an Array in PHP
How To Test If a Variable Is an Array in PHP?
✍: FYIcenter.com
Testing if a variable is an array is easy. Just use the is_array() function. Here is a PHP script on how to use is_array():
<?php
$var = array(0,0,7);
print("Test 1: ". is_array($var)."\n");
$var = array();
print("Test 2: ". is_array($var)."\n");
$var = 1800;
print("Test 3: ". is_array($var)."\n");
$var = true;
print("Test 4: ". is_array($var)."\n");
$var = null;
print("Test 5: ". is_array($var)."\n");
$var = "PHP";
print("Test 6: ". is_array($var)."\n");
print("\n");
?>
This script will print:
Test 1: 1 Test 2: 1 Test 3: Test 4: Test 5: Test 6:
⇒ Retrieving Values out of an Array in PHP
2016-10-15, ∼2842🔥, 0💬
Popular Posts:
How to add an API to an API product for internal testing on the Publisher Portal of an Azure API Man...
How to troubleshoot the Orderer peer? The Docker container terminated by itself. You can follow this...
How to use the JSON to XML Conversion Tool at freeformatter.com? If you want to try the JSON to XML ...
Why I am getting "LNK1104: cannot open file 'MSCOREE.lib'" error when building a C++/CLI program? Vi...
What Is session_register() in PHP? session_register() is old function that registers global variable...