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, 5147👍, 0💬
Popular Posts:
What are the two fundamental objects in ADO.NET ? Datareader and Dataset are the two fundamental obj...
Can we have static indexer in C# ? No.
How To Create an Array in PL/SQL? - Oracle DBA FAQ - Introduction to PL/SQL If you want create an ar...
What is the concept of XPOINTER? XPOINTER is used to locate data within XML document. XPOINTER can p...
What are the two kinds of comments in JSP and what's the difference between them? <%-- JSP Co...