is_array

Is_array function returns Boolean value ( true of false ) based on the input data. It returns true if variable is an array. Here is an example

$a= array("Three", "two", "Four", "five","ten");
$b="Hello Welcome to plus2net ";
if(is_array($a)){ // Change this variable to $b
echo " This is an array ";
}else{
echo " This is not an array ";
}

The above code will return This is an array if $a is checked.

Example

<?Php
$str="Learn web programming at plus2net.com";
echo is_array($str) ? 'Yes, Array' : 'not an Array';
?>

Output is

not an Array

By using split function we can break a sting and create an array. Here is the modified code.

<?Php
$str=split(" ","Learn web programming at plus2net.com");
echo is_array($str) ? 'Yes, Array' : 'not an Array';
?>

Output is

Yes, Array

Subscribe to our mailing list

* indicates required
Subscribe to plus2net
Visitors Rating
Your Rating


Google+

Post Comment This is for short comments only. Use the forum for more discussions.




Subscribe to our mailing list

* indicates required
Subscribe to plus2net
HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us
©2000-2018 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer