Re: For Loops and Variables??
| From: | Curt Zirzow | Date: | Sat, 13 Sep 2003 16:58:04 +0000 |
| Subject: | Re: For Loops and Variables?? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-162501@lists.php.net to get a copy of this message | ||
* Thus wrote John Ryan (celticfc@iol.ie):
> When I use for loops, at the start of each iteration, the variables hold the
> values from the last loop.
>
> First, is there an elegant way of clearing variables at the start of each
> loop rather than using unset???! It just seems wrong.
I'm unclear as to what elegant implies.
>
> Also, all my problems would be solved if variables in a for loop were kept
> local, but everything by default is a global. Can I change this in php.ini
> or something??
no, there are only two scopes in php, it is either GLOBAL or local inside
a function/class.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."