Posted by laredotornado on 02/11/06 22:43
Hi,
Wondered if there was a good one-liner for what I want to do in PHP 4.
I have an array, with an arbitrary number of elements. I'd like to
know if all the elements in the array are empty. If at least one
element is non-empty, then the entire condition is false.
$my_arr = array();
$my_arr[0] = "";
$my_arr[1] = "";
$all_empty = something($my_arr); // should contain the value TRUE
$my_arr = array();
$my_arr[0] = "";
$my_arr[1] = " hi ";
$my_arr[2] = "";
$all_empty = something($my_arr); // should contain the value FALSE
Any slick ways to find this out? - Dave
Navigation:
[Reply to this message]
|