note 78958 deleted from function.list by googleguy

From: Date: Thu, 13 Sep 2012 10:04:56 +0000
Subject: note 78958 deleted from function.list by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-190700@lists.php.net to get a copy of this message
Note Submitter: Hayley Watson ---- In the code by tenz699 at hotmail dot com, the list() construct is taking values from the result of the each() function, not from the associative array; the example is therefore spurious. each() returns an array of four elements, indexed in the order 1, 'value', 0, 'key'. As noted in the documentation, the associative keys are ignored, and the numerically-indexed values are assigned in key order. <?php $array = array('foo'=>'bar'); $t = each($array); print_r($t); list($a,$b,$c,$d) = $t; var_dump($a); var_dump($b); var_dump($c); var_dump($d); ?> Output: Array ( [1] => bar [value] => bar [0] => foo [key] => foo ) string(3) "foo" string(3) "bar" NULL NULL

« previous php.notes (#190700) next »