foreachif suggestion
- From: Hugh Oxford <arestes@xxxxxxx>
- Date: Sat, 28 Jun 2008 12:40:17 +0100
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.
.
- Follow-Ups:
- Re: foreachif suggestion
- From: Captain Paralytic
- Re: foreachif suggestion
- From: Dikkie Dik
- Re: foreachif suggestion
- Prev by Date: Re: Blog on PHP Bits & Pieces
- Next by Date: Re: foreachif suggestion
- Previous by thread: Re: General Motors
- Next by thread: Re: foreachif suggestion
- Index(es):