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
[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
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
[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
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
> 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(
I was hoping for something that looked (at least to me) a little
cleaner. Someone else gave me the answer and here is my final code that
works out just great for me.
for($letter = 'A', $i = 0; $i <= 25; $letter++, $i++ ){
echo "$letter ";
}
Amazing what I learned
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; $
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
[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
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
[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(
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..
13 matches
Mail list logo