Is it possible to get a range with PHP from A to ZZ*?
a b c ... aa ... zx zy zz
For me this didn't work:
range('A', 'ZZ');
It's for PHPExcel, when it gives BE as highest field i'd run through all colums. In this case i only get A, B:
range ('A', 'BE')
I use alpha2num() to convert alpha to number and then use it in loop. With this I can get the range using any value for the start and end.
It's not possible with the built-in
range
:However, in essence what you are doing here is counting upwards from 1 in a numeric system that uses the 26 digits
a
toz
. So you can quickly hack together a solution by counting, converting to base 26 (which uses the digits0
to9
anda
top
) and then "translating" the digits to the rangea
toz
.it's working
This is as far as I can help you (generate array with A through Z).
Check out chr and array_walk
Even better option (Working great)
Take advantage of PHP's ability to increment characters "perl-style"
But you could also use simple integer values, and take advantage of PHPExcel's built-in PHPExcel_Cell::stringFromColumnIndex() method
EDIT
From PHP 5.5, you can also use Generators to avoid actually building the array in memory