foreachif suggestion



Can I suggest a new PHP native function, "foreachif".

At the moment I am trying to make my code run cleanly even if warnings are switched on. If I do a foreach on a non-existent array, I get a warning.

So I have to do

if($array) foreach($array as $foo){};

foreachif would only run if the array was not empty.
.


Quantcast