Re: Bug #13871: 'for()'-error using chars as break
| From: | Teodor Cimpoesu | Date: | Tue, 30 Oct 2001 14:21:45 +0000 |
| Subject: | Re: Bug #13871: 'for()'-error using chars as break | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-69331@lists.php.net to get a copy of this message | ||
Hi Martin.Schmitz!
On Tue, 30 Oct 2001, Martin.Schmitz@Uni-Bielefeld.de wrote:
> From: Martin.Schmitz@Uni-Bielefeld.de
> Operating system: Linux
> PHP version: 4.0.6
> PHP Bug Type: *Programming Data Structures
> Bug description: 'for()'-error using chars as break
>
> <?PHP
>
> for($i='A'; $i<='Z'; $i++){
> echo $i;
> }
I saw it thousand times... ppl just miss that
"'a string' is 0 when compared to integers".
try this instead:
foreach (range(ord('A'),ord('Z')) as $i) echo chr($i);
ciao
-- teodor