Ensure a number is three digits long

From: Date: Sun, 13 Feb 2005 17:09:13 +0000
Subject: Ensure a number is three digits long
Groups: php.general 
Request: Send a blank email to php-general+get-208600@lists.php.net to get a copy of this message
Hi, I have am trying to create functions to convert strings to ascii and vice versa: function string_to_ascii( $str ) { for( $i=0; $i < strlen( $str ); $i++ ) { $asc .= ord( substr( $str, $i ) ); } return $asc; } This function works fine, however I need to ensure that the ASCII convertions are three digits long so that I know where to split the ASCII string when converting back to a normal string. i.e. 97 must be 097. Thanks for any advice offered

« previous php.general (#208600) next »