Just an observer, but I love how you each had a different way of accomplishing this task! ;-)
And Mike, looks like you have some re-writing to do now that Martin and Kevin showed you a WAY simpler (and faster) way to accomplish what you did. LOL. http://daevid.com > -----Original Message----- > From: Martin Towell [mailto:[EMAIL PROTECTED] > > sprintf/printf("%7d", $num) -----Original Message----- >From: Kevin Waterson [mailto:[EMAIL PROTECTED] > >print str_pad($something, 7, "0", STR_PAD_LEFT); -----Original Message----- From: Mike Brum [mailto:[EMAIL PROTECTED] This is what I did for a dynamic zero-fill for renaming batches of files: // Get "Zero Padding" For New Image Names $zero_padding = strlen(count($image_array)); foreach($image_array as $temp){ $n++; $n_length = strlen($n); for($i = 0; $i < ($zero_padding - $n_length); $i++){ $n = "0" . $n; } $new_name = $image_inbox . "/" . $newName . "-" . $n . ".jpg"; rename("$image_inbox/$temp", $new_name); } I'm not sure if this will be applicable to your situation, but it works perfectly for me since it will zero-fill for any length of numbers and pad the shorter numbers appropriately. > -----Original Message----- > From: Harry.de [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 20, 2003 10:09 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Zero Fill -> Number Format > > > How can I put out a Zero Fill for numbers > The result should be > > $something=26; > echo $something; > > e.g. > 0000026 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php