I want to check for some cases, but I can't get this to work.
$a
and $b
have values, but I have arrays like $c
that I do not wish to print.
How to do this?
$a = array("1", "2", "3");
$b = array("A"); // array(1) { [0]=> string(5) "A" }
$c = array(""); // array(1) { [0]=> string(0) "" }
function does_have_value($arr) {
if (!empty($arr)) {
echo 'have value';
}
}
does_have_value($a); // have value
does_have_value($b); // have value
does_have_value($c); // have value (but I want this to fail)