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.
-M
-----Original Message-----
From: Harry.de [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 19, 2003 6:09 PM
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
I didn't found a solution with number format. Is there any other way?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php