Re: Variable Scope
| From: | LingWitt at insightbb dot com | Date: | Sun, 31 Aug 2003 02:33:31 +0000 |
| Subject: | Re: Variable Scope | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-4302@lists.php.net to get a copy of this message | ||
I am saying that perhaps the for loop should treat that part as a declaratory statement and mask outer variables.
On Saturday, Aug 30, 2003, at 15:28 America/New_York, Rasmus Lerdorf wrote:
Yes, but you are adding a declaration separate from the for loop there. So not the same at all given there is no declaration in PHP. On Sat, 30 Aug 2003 LingWitt@insightbb.com wrote:Not so. I supplied this version earlier: int array[] = {1, 2, 3, 4, 5}; for (int i = 0; i < 5; i++) {int num = array[i]; printf("%d", num); for (int i = 0; i < 5; i++) printf("%d", i * num);} On Saturday, Aug 30, 2003, at 15:19 America/New_York, Rasmus Lerdorf wrote:It was based on the for construct from C and works exactly the same way.