note 69845 deleted from function.chr by danbrown

From: Date: Wed, 15 Sep 2010 21:10:26 +0000
Subject: note 69845 deleted from function.chr by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-172594@lists.php.net to get a copy of this message
Note Submitter: jasonwiener.com ---- 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---

« previous php.notes (#172594) next »