Re: Variable scopes for language constructs (foreach, ...)
| From: | Chris Stockton | Date: | Thu, 23 Jun 2011 18:55:49 +0000 |
| Subject: | Re: Variable scopes for language constructs (foreach, ...) | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-53548@lists.php.net to get a copy of this message | ||
Hello,
On Thu, Jun 23, 2011 at 8:49 AM, Martin Scotta <martinscotta@gmail.com> wrote:
> Martin Scotta
>>
> foreach ($values as $value) {
> // use $value
> }
> unset ($value); // <-- unset done inside core
>
> foreach ($values as $key => $value) {
> // use $key and $value
> }
> unset ($key, $value); // <-- unset done inside core
>
> will this just do the trick?
>
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.
-Chris