list(), each()

From: Date: Mon, 25 Mar 2002 17:22:07 +0000
Subject: list(), each()
Groups: php.general 
Request: Send a blank email to php-general+get-90055@lists.php.net to get a copy of this message
Ok, I've got to be doing something wrong here. I've been beating my head up against the wall for some time and I just cannot figure out what it is. Before I say it's a bug with list(), could someone tell me what I'm doing wrong? <? $policy = "1016726726--1--1016643856"; // problematic list( $policy_num, $policy_year, $application_reference ) = each( explode( "--", $policy )); echo "list( $policy_num, $policy_year, $application_reference ) = each( explode( \"--\", $policy )); <br>\n"; // fine $policy = explode( "--", $policy ); echo $policy[0] . "<br>\n"; echo $policy[1] . "<br>\n"; echo $policy[2] . "<br>\n"; ?> Why isn't list() assigning the value properly? For the first echo statement, I'm getting: "list( 0, 1016726726, ) = each( explode( "--", 1016726726--1--1016643856 ));" but the others, where I'm echoing out the individual elements, it's working fine. What's going on? Chris

« previous php.general (#90055) next »