RE: [PHP] list(), each()
| From: | Rick Emery | Date: | Mon, 25 Mar 2002 17:27:59 +0000 |
| Subject: | RE: [PHP] list(), each() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-90060@lists.php.net to get a copy of this message | ||
change to:
list( $policy_num, $policy_year, $application_reference ) = explode( "--",
$policy );
-----Original Message-----
From: Chris Boget [mailto:chris@wild.net]
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