On 06/23/11 21:48, John Crenshaw wrote:
>> I think proposed change is extremely counter intuitive to the design
>> of PHP in regard to scoping and would be a very large bc break, PHP is
>> doing exactly what it is suppose to do here and I wouldn't want it any
>> other way.
> Agreed. Although I generally favor the idea of strong scope, it isn't
practical to implement in PHP. It isn't sensible because PHP doesn't
require explicit variable declaration, and the BC break would be crippling.
So what about modifying the loop syntax slightly, to explicitly scope a
variable in a foreach? Or would this be problematic/counter-intuitive too?

foreach ($abc as var $def) {
}

and

foreach ($abc as var &$def) {
}


Dave


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to