note 17382 deleted from function.each by jimw

From: Date: Thu, 20 Dec 2001 21:29:07 +0000
Subject: note 17382 deleted from function.each by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-23452@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

« previous php.notes (#23452) next »