Easy Way.

From: Date: Sun, 09 Mar 2003 21:17:35 +0000
Subject: Easy Way.
Groups: php.general 
Request: Send a blank email to php-general+get-138881@lists.php.net to get a copy of this message
Hello, Is there an easy way to change an integer to a 5 caracters string. For example: $i = 3 ; $j = 110 ; After having changed them: $i = "00003" ; $j = "00110" ; Is there a php function to do so instead of doing this:
      if( ($i>0)&&($i<10)) {
$i = "0000".$i ;
      } else if( ($i>9)&&($i<100)) {
$i = "000".$i ;
      } else if( ($i>99)&&($i<1000)) {
$i = "00".$i ;
      } etc...
Thanks :-) Vincent.

« previous php.general (#138881) next »