ID: 10203
User updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Old Status: Closed
Status: Open
Bug Type: Feature/Change Request
Operating System: all
PHP Version: 4.0.4pl1
New Comment:

you haven't read the previous posts, have you?

I think it's a general problem with list() construct, that you cannot
use it everywhere you can use an L-value (or however you guys call it
in PHP)


Previous Comments:
------------------------------------------------------------------------

[2002-01-28 20:45:41] [EMAIL PROTECTED]

foreach ($arr as $key => $val)


------------------------------------------------------------------------

[2001-04-11 11:17:31] [EMAIL PROTECTED]

sure, I know I could use this way but I don't find it nice at all.

------------------------------------------------------------------------

[2001-04-06 14:42:55] [EMAIL PROTECTED]

It's for someone else to decide whether to add this to 
the language, but until they do you can achieve the same
effect with:

$arr = array(array(1, 2), array(3, 4)); 
foreach ($arr as $narr) {
    list($a, $b) = array_values($narr);
    echo "$a, $b\n";
}

BTW--it would have helped if you had explained what 
results you were after and not just the syntax you wanted. ;)

------------------------------------------------------------------------

[2001-04-06 07:54:29] [EMAIL PROTECTED]

no, 'list' should assign an array to a list of variables.

$arr = array(array(1, 2), array(3, 4));

foreach ($arr as list($a, $b))
        echo "$a $b\n";


------------------------------------------------------------------------

[2001-04-06 07:19:30] [EMAIL PROTECTED]

and what should it do?

i guess you want to have key and value in one step?

this is done by the foreach($array as $key => $value)
construct, does that satisfy your needs?

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/?id=10203


Edit this bug report at http://bugs.php.net/?id=10203&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to