php

Use of is_array, is_string ,is_real function – PHP

echo ” Checking is_null() function”;
$xp =’ram’;

if(is_null($xp)){ // is_null function checks if variable is null or not
echo “Null XP”;
}
elseif (is_string($xp)) // is_string function checks if variable is string
{
echo “Xp is string “;
echo strval($xp); // strval function gives if variable is string
}
else if(is_array($xp)) // is_array function checks if variable is array
{
echo “xp is array”;
print_r($xp);

}
else if(is_real($xp)) // is_real function checks if variable is float /decimal
{
echo “XP is real number”;
}
else if(isset($xp))
{
echo “its set”;
}

?>

Leave a Reply

Your email address will not be published. Required fields are marked *