PHP Excel z Z do AA
I was looking for a simple method to construct excel like column identifiers e.g: A B .... AA AB AC etc, using chr() and modulo, but there is magic...
https://www.php.net/manual/en/language.operators.increment.php
So, this also works
<?php
$p = chr(65); // or simply $p = 'A';
for ($i = 1; $i < 53; $i++){
echo $p++ . " - ";
if ($i % 10 == 0) echo '</br>';
}
?>
Gives
A - B - C - D - E - F - G - H - I - J -
K - L - M - N - O - P - Q - R - S - T -
U - V - W - X - Y - Z - AA - AB - AC - AD -
AE - AF - AG - AH - AI - AJ - AK - AL - AM - AN -
AO - AP - AQ - AR - AS - AT - AU - AV - AW - AX -
AY - AZ -
Innocent Impala