Hi all, I'd like to propose an alternative for the foreach statement.
Of course the construct: while (list($i,$d)=each($A)) is much harder to read than: foreach ($A as $i=>$d) and although I had doubts at first I'm currently rewriting all my old scripts to the new format whenever I encounter them, but I would have much rather seen that this problem hadn't been solved using a new statement but with a new operator like: while (each $i=>$d in $A) or shorter: while ($i=>$d in $A) I think that my solution to the problem has several advantages: 1. It's possible to use the in-operator as part of a more complex expression like: for (;$d in $A and $t++<10;) //I use this a lot temporarily //in the testing phase of scripts It would even be possible to write something like: while ($d in $D and $e in $E) { $A[]=$d+$e; } 2. Rewriting old code is much easier because the variables stay in the same order. 3. One is free to use a while or a for statement. I wouldn't bring this matter up if it already was 'water under the bridge', but this syntax doesn't conflict with the foreach syntax, so I'm just suggesting that my syntax is added too, so people can choose what they use. It wouldn't surprise me when the foreach syntax would be deprecated soon... Greetings, Jaap -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php