change to:
list( $policy_num, $policy_year, $application_reference ) = explode( "--",
$policy ); 


-----Original Message-----
From: Chris Boget [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 11:22 AM
To: PHP General
Subject: [PHP] list(), each()


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



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to