Edit report at http://bugs.php.net/bug.php?id=51797&edit=1
ID: 51797 Updated by: degeb...@php.net Reported by: rc at opelgt dot org Summary: valid arguments for foreach -Status: Open +Status: Feedback Type: Feature/Change Request Package: *General Issues PHP Version: 5.2.13 New Comment: The following script works fine for me: <?php $array = array( array('foo','bar'), array('test','hello'), ); $i = 0; foreach ($array[$i] as $key => $val) { echo $key . $val; } ?> You'll have to provide a complete script that gives unexpected/incorrect warnings. Previous Comments: ------------------------------------------------------------------------ [2010-05-11 18:25:31] rc at opelgt dot org Description: ------------ When I give an array to loop through the name of the array and if the array given is with a key, in this case $i, should make no difference. PHP4 didnt make a warning, PHP5 instead does. Test script: --------------- foreach($array[$i] as $key => $val) results in an warning message. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=51797&edit=1