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:
Â
⇒Understanding PHP Arrays and Their Basic Operations
⇒⇒PHP Tutorials
2016-10-15, 1237👍, 0💬
Popular Posts:
Where to find tutorials on Using Azure API Management Developer Portal? Here is a list of tutorials ...
Where Can I get a copy of the RSS XML Schema? RSS XML Schema is an XML Schema that defines how an RS...
How to view API details on the Publisher Portal of an Azure API Management Service 2017 version? You...
How to use urllib.parse.urlencode() function to encode HTTP POST data? My form data has special char...
What Is Azure API Management Service? Azure API Management as a turnkey solution for publishing APIs...