php - How do I display Excel-style cells from A to BJ? -


how display excel-style cells bj ?

<?php ($i = 'a'; $i <= 'bj'; $i++)  {         echo $i."<br>"; }    ?> 

only displays a , b. have stop @ bk display till bj. how work till zz ?

<?php ($i = 'a'; $i <= 'zz'; $i++)  {         if ($i == 'bk') break;     echo $i."<br>"; }    ?> 

the problem using <=.... because comparison alphabetic when you're comparing strings, , z less za, , c > bj... need use !== comparison....

take end point

$endpoint = bj; 

increment that

$endpoint++; 

then do

for ($i = 'a'; $i !== $endpoint; $i++) { ... } 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -