note 17382 added to function.each
| From: | trapeer dot N0_Sp4m at egon dot gyaloglo dot hu | Date: | Thu, 06 Dec 2001 13:31:36 +0000 |
| Subject: | note 17382 added to function.each | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-21708@lists.php.net to get a copy of this message | ||
Hi,
maybe you are writing huge scripts, and like to
make things compact... Then You may find this
little idea nice and practical: instead of the
while(), use a for() when you need the array pairs
for a simple function only (just output,
for e.g.), then it goes like this:
$printthis = array("a"=>12,"b"=>25,"c"=>4);
for ( reset($printthis); list($key,$val)=each($printthis); echo"$key=>$val,");
and that's it... Just don't be fooled by the wrapping here, try it :)
Trapeer
--
http://www.php.net/manual/en/function.each.php
http://master.php.net/manage/user-notes.php?action=edit+17382
http://master.php.net/manage/user-notes.php?action=delete+17382
http://master.php.net/manage/user-notes.php?action=reject+17382