Re: [PHP] counting with leading zeros
- From: robert@xxxxxxxxxxxxx (Robert Cummings)
- Date: Thu, 27 Sep 2007 09:21:30 -0400
On Wed, 2007-09-26 at 21:56 -0700, Jim Lucas wrote:
Now, if you plan to delete any images in the list, this will not work.
But if you don't expect to delete any images in the list and always want
the ($total_images + 1), then follow along.
<?php
function getNextImage($path, $prefix) {
$filelist = glob("${path}${prefix}*") or return '01';
return str_pad(((int)count($filelist)+1), 2, '0', STR_PAD_LEFT);
}
?>
Nice :)
Cheers,
Rob.
--
............................................................
SwarmBuy.com - http://www.swarmbuy.com
Leveraging the buying power of the masses!
............................................................
.
- References:
- counting with leading zeros
- From: brian
- Re: [PHP] counting with leading zeros
- From: Jim Lucas
- counting with leading zeros
- Prev by Date: Re: [PHP] [Fwd: Attachment Size and Memory limit with php and FC6 System]
- Next by Date: Re: [PHP] [Fwd: Attachment Size and Memory limit with php and FC6 System]
- Previous by thread: Re: [PHP] counting with leading zeros
- Next by thread: Re: [horde] Requirement of IMP / Horde
- Index(es):