note 41531 added to function.chr
| From: | jmartin at prescientsoftware dot com | Date: | Tue, 13 Apr 2004 18:42:22 +0000 |
| Subject: | note 41531 added to function.chr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-68087@lists.php.net to get a copy of this message | ||
Here is a function that will convert column numbers in to a letters for use in a spreadsheet. It is
limited up to 'ZZ' but can easliy by modifed.
function col2chr($a){
if($a<27){
return strtoupper(chr($a+96));
}else{
while($a > 26){
$b++;
$a = $a-26;
}
$b = strtoupper(chr($b+96));
$a = strtoupper(chr($a+96));
return $b.$a;
}
}
----
Manual Page -- http://www.php.net/manual/en/function.chr.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41531
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41531&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41531&report=yes
Search -- http://master.php.net/manage/user-notes.php