note 41147 deleted from control-structures.foreach by tomsommer

From: Date: Wed, 31 Mar 2004 23:12:56 +0000
Subject: note 41147 deleted from control-structures.foreach by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-67436@lists.php.net to get a copy of this message
Note Submitter: Mister ZASX ---- Here's a note, something mildly annoying: If you use foreach() on an array that happens to be empty, you will get an error, so in cases where you're building an array dynamically and the array might be empty, you have to test for sizeof($array) > 0 before doing a foreach(). It would be nice if foreach() just skipped itself for empty arrays, but it's not hard to test ... just more typing. :)

« previous php.notes (#67436) next »