note 91342 deleted from function.intval by cmb

From: Date: Sun, 16 Feb 2020 13:52:40 +0000
Subject: note 91342 deleted from function.intval by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-214153@lists.php.net to get a copy of this message
Note Submitter: bert at nospam dot thinc dot nl ---- 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 ); } ?>

« previous php.notes (#214153) next »