Re: stepping through alphabet

From: Date: Wed, 19 Nov 2003 14:36:32 +0000
Subject: Re: stepping through alphabet
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-170290@lists.php.net to get a copy of this message
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; $i <= 25; $letter++, $i++ ){
                echo "<a href=\"?action=alphabet&letter=$letter\">$letter</a> ";
        }
Thank You So Much Steve At 08:27 AM 11/19/2003, you wrote:
Sophie Mattoug wrote:
Maybe you can try this for ($letter = 'A'; $letter++; $letter <= 'Z') echo "<a href=\"?action=alphabet&letter=$letter\">$letter</a>\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).... for ( $letter = 'A', $i = 0; $i <= 25; $letter++, $i++ )
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 href="?action=alphabet&letter=A">A</a> <a href="?action=alphabet&letter=B">B</a> <a href="?action=alphabet&letter=C">C</a> etc........... I am sure that this has been done and is probably pretty easy. Any help here would be appreciated. I know that I could just create a link for each letter, but I would like to learn to do this so that I can make code shorter. Putting each letter into an array and steping through the array will work, but can it be done by telling a loop to start at A and end at Z? Thanks Steve
-- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#170290) next »