note 103266 deleted from function.list by googleguy

From: Date: Fri, 28 Sep 2012 09:11:20 +0000
Subject: note 103266 deleted from function.list by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-191054@lists.php.net to get a copy of this message
Note Submitter: lili at nikha dot org ---- Keep it simple! For associative arrays, my replacement for list() is this: <?php foreach ($associative_array as $key => $value) { $$key = $value; } ?> Example: <?php $petnames = array(); $petnames['dog'] = 'Paul'; $petnames['cat'] = 'Lili'; foreach ($petnames as $name => $value) { $$name = $value; } echo 'my pets are '.$dog.' and '.$cat; ?> Will give you: my pets are Paul and Lili

« previous php.notes (#191054) next »