Thank you for the first decent response. I concede.

On Sunday, Aug 31, 2003, at 07:09 America/New_York, Zeev Suraski wrote:

As illustrated, we're not considering a change because what you're suggesting contradicts fundamental building blocks of PHP: no need to declare variables, and the fact that there's only one scope. There's nothing special in for loops, not in PHP, and not even in the early C++ implementations. In recent C++ implementations, variable declarations in the for statement are considered to belong to the code block inside the for loop, but it didn't even use to be that way in earlier implementations of C++ (e.g., Visual C++ 6). The point is that it all boils down to the issue of declaring variables, and variable scope in general, which is completely different in PHP from the way it is in C or C++. Making an exception with for loop makes absolutely no sense at all, as it's completely inconsistent with the way PHP behaves with code blocks in general.

In PHP, variables are declared when you first use them. They live for as long as the current function lives - there's only one scope in PHP, and that's the function scope. Both of these are not going to change, as again, they're a part of the basics that make PHP what it is.

Zeev

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



Reply via email to