Page 1 of 1
Character increment
Posted: Mon Oct 26, 2009 3:08 am
by GinsBabu
Hi,
I am facing a scenario like above,but in my case i want to show up like Col A,Col B etc....The container where i am displaying this is being dynamically generated using jquery.Any help?
Re: Character increment
Posted: Mon Oct 26, 2009 4:32 am
by papa
Using PHP you can create an array to retrieve letters from:
Code: Select all
$letters = range('a', 'z');
...
foreach (range('a', 'z') as $letter) {
echo $letter;
}
Re: Character increment
Posted: Mon Oct 26, 2009 4:50 am
by Mark Baker
Character increment seems to be flavour of the month
See
this thread
Re: Character increment
Posted: Tue Oct 27, 2009 2:14 am
by GinsBabu
Hi ,
Great thanks for ur responses(mark and papa)..i found out a solution for that..
char = 'a';
print ++$char . PHP_EOL;
that would do the trickk.

Re: Character increment
Posted: Tue Oct 27, 2009 6:03 am
by pbs
One more option to display characters
Code: Select all
For Uppercase A - Z
for($i=65;$i<=90;$i++)
{ echo chr($i); }
For Lowercase a - z
for($i=97;$i<=122;$i++)
{ echo chr($i); }