arianhojat Posted January 30, 2007 Share Posted January 30, 2007 <?php$foo = array("Robert" => "Bob", "Seppo" => "Sepi");$bar = each($foo);print_r($bar);echo "\n\n";//So this shows that each() returns a 4 element array so if you supposedly pass it to list() with 4 arguements within list(), how come only the index keys from the array created by each() only come over?reset($foo); //start array pointer back to beginning since called each() be4while ( list($key, $val, $assosKey, $assocVal) = each($foo) )echo "$key => $val (or $assosKey => $assocVal)\n";//only prints out index values, but not the associative key/value pairs returned by the array.//Is it cause they one points to same place in memory really, so one is really a reference to the other?//or the list function only can take the index keys??> Link to comment https://forums.phpfreaks.com/topic/36392-quick-question-on-list-and-each/ Share on other sites More sharing options...
arianhojat Posted January 31, 2007 Author Share Posted January 31, 2007 bump... Link to comment https://forums.phpfreaks.com/topic/36392-quick-question-on-list-and-each/#findComment-173836 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.