Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Test If a Variable Is an Array
How To Test If a Variable Is an Array? - PHP Script Tips - Understanding PHP Arrays and Their Basic Operations
✍: 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:
2007-04-20, 5146👍, 0💬
Popular Posts:
What will be printed as the result of the operation below: main() { char s1[]="Cisco"; char s2[]="sy...
What is the purpose of finalization? The purpose of finalization is to give an unreachable object th...
What Is a TD Tag/Element? - XHTML 1.0 Tutorials - Understanding Tables and Table Cells A "td" elemen...
Can you explain different software development life cycles -part II? Water Fall Model This is the ol...
What Are Named Parameters? - Oracle DBA FAQ - Creating Your Own PL/SQL Procedures and Functions Name...