I am doing an Excel-like webapp where the columns are "numbered" like a,b,c,...,aa,ab,...,az,ba,...,zz,aaa,.... But if I write
$start = 'a';
$end = 'z';
while($start <= $end){
echo $start++ . ", ";
}
(notice $start <= $end) it will go a up to yz, not just a-z because
echo 'aa' <= 'z'; // true, but
echo 'za' <= 'z'; // false.
Is there a function or a way to compare two variables taking in mind that
$a = "z"; echo ++$a; // aa
$a = "zz"; echo ++$a; // aaa
so that
$a = "z"; $b = $a; $b++; // $b = aa
AisLessThanB(a,b); // returns true
and so on? That means where
a < z < aa < az < zz < aaa < zzz < aaaa
is always true?
EDIT: Something like
$start = 'a';
$end = 'cv'; // 100 columns
should work since we work with loads of columns.
Thank you!