RE: [PHP] stepping through alphabet

2003-11-19 Thread Don Read
On 19-Nov-2003 Steve Buehler wrote: > > Amazing what I learned today. :) I love this list and its people. > How about one more? (ver 4.1.0): foreach(range('A', 'Z') as $letter) { echo $letter, "\n"; } Regards, -- Don Read [EMAIL PROTECTED] -- It's alw

RE: [PHP] stepping through alphabet

2003-11-19 Thread Jay Blanchard
[snip] OK, my bad -- I let my fingers do the talking without proper monitoring from my brain. This is what I actually use in more than a few scripts: for ($c='A'; $c!='AA'; $c++): echo $c; endfor; I just forgot to change the comparison from <= to != I guess this

RE: [PHP] stepping through alphabet

2003-11-19 Thread Ford, Mike [LSS]
On 19 November 2003 16:15, Jay Blanchard contributed these pearls of wisdom: > [snip] > 'Z'+1 is defined to be 'AA' (it says that in the manual, > too!), so your loop has to be: > > for($letter = 'A'; $letter <= 'AA'; $letter++){ > echo $letter . "\n"; > } > [/snip] > > Run this, you'l

RE: [PHP] stepping through alphabet

2003-11-19 Thread Jay Blanchard
[snip] 'Z'+1 is defined to be 'AA' (it says that in the manual, too!), so your loop has to be: for($letter = 'A'; $letter <= 'AA'; $letter++){ echo $letter . "\n"; } [/snip] Run this, you'll be surprised at what you get. -- PHP General Mailing List (http://www.php.net/) To unsubscrib

RE: [PHP] stepping through alphabet

2003-11-19 Thread Ford, Mike [LSS]
On 19 November 2003 14:25, Jay Blanchard contributed these pearls of wisdom: > [snip] > for ($letter = 'A'; $letter++; $letter <= 'Z') > echo " href=\"?action=alphabet&letter=$letter\">$letter\n"; > [/snip] > > I tested this and found two small problems. The code works if > you do this (I was

Re: [PHP] stepping through alphabet

2003-11-19 Thread Chris Boget
> I tested this and found two small problems. The code works if you do > this (I was myself amazed that letters would increment) But is that a bug? Or a feature? You could also do this, which would probably be more universal: // 65 through 90 for upper case // 97 through 122 for lower case for(

RE: [PHP] stepping through alphabet

2003-11-19 Thread Steve Buehler
','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'); foreach($letters as $let

Re: [PHP] stepping through alphabet

2003-11-19 Thread Steve Buehler
YES That is the kind of code that I was looking for. I never thought you could do it like that either. Meaning putting 2 things to do ($letter++ and $i++) into the loop in this fashion. This looks so much cleaner to me. Here is my final function now. for($letter = 'A', $i = 0; $

RE: [PHP] stepping through alphabet

2003-11-19 Thread Steve Buehler
Yes, I found that the loop was written kind of backwards and would create a never ending loop. I never thought to try setting $letter='A' before. I didn't think you could loop through the Alphabet like that. But I did a little changing to your loop and it works fine like this now: $le

RE: [PHP] stepping through alphabet

2003-11-19 Thread Jay Blanchard
[snip] for ($letter = 'A'; $letter++; $letter <= 'Z') echo "$letter\n"; [/snip] I tested this and found two small problems. The code works if you do this (I was myself amazed that letters would increment) for($letter = 'A'; $letter < 'Z'; $letter++){ echo $letter . "\n"; } The problem s

Re: [PHP] stepping through alphabet

2003-11-19 Thread John Nichel
Sophie Mattoug wrote: Maybe you can try this for ($letter = 'A'; $letter++; $letter <= 'Z') echo "$letter\n"; Hope this helps The for loop is backwards for ($letter = 'A'; $letter <= 'Z'; $letter++) However, I don't think that will work, you probably need to do something like this (untested

RE: [PHP] stepping through alphabet

2003-11-19 Thread Jay Blanchard
[snip] I am using PHP 4.3.4 and am trying to come up with a function that will step through the alphabet so that I get a menu/links that can be clicked on like below: A B C etc... [/snip] Create an alphabet array and loop through it ... $arrayAlphabet = ('A', 'B', 'C', , 'Z'); for(

Re: [PHP] stepping through alphabet

2003-11-19 Thread Sophie Mattoug
Maybe you can try this for ($letter = 'A'; $letter++; $letter <= 'Z') echo "$letter\n"; Hope this helps Steve Buehler wrote: I am using PHP 4.3.4 and am trying to come up with a function that will step through the alphabet so that I get a menu/links that can be clicked on like below: A B C etc..

[PHP] stepping through alphabet

2003-11-19 Thread Steve Buehler
I am using PHP 4.3.4 and am trying to come up with a function that will step through the alphabet so that I get a menu/links that can be clicked on like below: A B C etc... I am sure that this has been done and is probably pretty easy. Any help here would be appreciated. I know that I