- Forums
- PHP
- How To Check If An Array Is Empty Or It Has A False Value
This Page Contains information about How To Check If An Array Is Empty Or It Has A False Value By php help in category PHP with 9 Replies. [1101], Last Updated: Sat May 18, 2024
php help
Mon Feb 25, 2008
9 Comments
33160 Visits
i want to know if you can help me. i have this code
<?php
$myarray= array();
$myarray[0] = "";
$myarray[1] = false;
if($myarray){
echo "this is true";
}else{
echo "this is false";
}
?>
but when i run it, it still comes out true?
when i do this:
PHPCODE:
print_r(array_values($myarray));
it shows me this:
Array ( [0] => ) how can i check or verify that an array has a value of zero or false then?