From:             black at scene-si dot org
Operating system: any
PHP version:      Irrelevant
PHP Bug Type:     Scripting Engine problem
Bug description:  foreach does not take list() as argument output

Description:
------------
Requesting additional functionality for foreach?

Reproduce code:
---------------
$table = array();
$table['username'] = array(1,"John doe");
$table['black'] = array(2,"Jane doe");
$table['yawn'] = array(3,"Undefined");

foreach ($table as $key=>list($id,$title)) {
  echo $key.":".$id.", ".$title."\n";
}
foreach ($table as list($id,$title)) {
  echo $id.", ".$title."\n";
}

Expected result:
----------------
username:1, John doe
black:2, Jane doe
yawn:3, Undefined
1, John doe
2, Jane doe
3, Undefined

Actual result:
--------------
Parse error

-- 
Edit bug report at http://bugs.php.net/?id=28919&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28919&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28919&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28919&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28919&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28919&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28919&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28919&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28919&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28919&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28919&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28919&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28919&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28919&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28919&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28919&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28919&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28919&r=float

Reply via email to