Hi,
anyone know if you can increment Alpha Charachters in a loop ?
for example I want to build an array with each element having a letter of the alphabet - $arr[0] = A, $arr[1] = B .....
Is there a way to do this easily in PHP
Cheers
Try $arr[0] = chr(65);
Hmm, that only sets A I need to set A-Z (26 elements), But you have given me an idea anyway cheers.
this dont the job:
$chr=65; for($i=0; $i<26; $i++){ $arr[$i] = chr($chr); $chr++; }
OK
<?php for ($i = 65; $i < 91; $i++) { $arr[($i - 65)] = chr($i); } ?>
$alphabet = range("A","Z");
then loop through the array