note 91342 added to function.intval
| From: | bert at nospam dot thinc dot nl | Date: | Sat, 06 Jun 2009 23:16:39 +0000 |
| Subject: | note 91342 added to function.intval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-156424@lists.php.net to get a copy of this message | ||
If you need the reverse function of intval(), the code hereunder might be helpfull.
<?php
function itoa( $ii, $radix=10, $stritoa="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabc" ) {
if ( $radix > strlen( $stritoa ) ) // does request makes sense?
return ""; // think of your own way to handle this case
$sign = $ii<0 ? "-": "";
$ii = abs( $ii );
$rc = "";
do {
$rc .= $stritoa[ $ii % $radix ];
$ii = floor( $ii / $radix );
} while ( $ii >0 );
return $sign . strrev( $rc );
}
?>
----
Server IP: 91.199.167.18
Probable Submitter: 81.173.113.62
----
Manual Page -- http://www.php.net/manual/en/function.intval.php
Edit -- https://master.php.net/note/edit/91342
Del: integrated -- https://master.php.net/note/delete/91342/integrated
Del: useless -- https://master.php.net/note/delete/91342/useless
Del: bad code -- https://master.php.net/note/delete/91342/bad+code
Del: spam -- https://master.php.net/note/delete/91342/spam
Del: non-english -- https://master.php.net/note/delete/91342/non-english
Del: in docs -- https://master.php.net/note/delete/91342/in+docs
Del: other reasons-- https://master.php.net/note/delete/91342
Reject -- https://master.php.net/note/reject/91342
Search -- https://master.php.net/manage/user-notes.php