Lexical scoping

From: Date: Tue, 28 Jan 2014 10:01:21 +0000
Subject: Lexical scoping
Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Good morning,

Perhaps a future version of PHP (PHP 6? 5.7?) could have lexical scoping with a
"let" keyword? At the very least, it would make foreach() with a reference less
of a problem:

    foreach ($array as let &$a) {
        $a = 3;
    }
    // $a is not in this scope - no need to worry about accidentally changing
last array item

Any thoughts?
--
Andrea Faulds
http://ajf.me/


Thread (11 messages)

« previous php.internals (#71663) next »