note 69845 added to function.chr
| From: | jasonwiener dot com at osu1 dot php dot net | Date: | Fri, 22 Sep 2006 17:58:10 +0000 |
| Subject: | note 69845 added to function.chr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-117457@lists.php.net to get a copy of this message | ||
In re: to Mike's post on converting int to alpha.
http://us3.php.net/manual/en/function.chr.php#54256
I'm using it to build an A-Z index and wanted to drive it using ints via a for loop. The prob
was it only produced a-y when i started @ 1 and incremeneted to 27. Made a couple changes and it
works great now. Thanks Mike for doing the heavy lifting.
J.
---start code---
function convertIntToAlphabet($int_wert) {
if($int_wert%27>=1) {
$alpha_string=chr(($int_wert%27)+64).$alpha_string;
$alpha_string=convertIntToAlphabet($int_wert/27).$alpha_string;
}
return $alpha_string;
}
---finish code---
----
Server IP: 216.194.113.175
Probable Submitter: 69.226.61.54
----
Manual Page -- http://www.php.net/manual/en/function.chr.php
Edit -- https://master.php.net/note/edit/69845
Del: integrated -- https://master.php.net/note/delete/69845/integrated
Del: useless -- https://master.php.net/note/delete/69845/useless
Del: bad code -- https://master.php.net/note/delete/69845/bad+code
Del: spam -- https://master.php.net/note/delete/69845/spam
Del: non-english -- https://master.php.net/note/delete/69845/non-english
Del: in docs -- https://master.php.net/note/delete/69845/in+docs
Del: other reasons-- https://master.php.net/note/delete/69845
Reject -- https://master.php.net/note/reject/69845
Search -- https://master.php.net/manage/user-notes.php