Re: [PHP] counting with leading zeros
- From: phplist@xxxxxxxxxxxxxxx (brian)
- Date: Thu, 27 Sep 2007 20:30:13 -0400
tedd wrote:
At 3:58 PM -0400 9/26/07, brian wrote:
Well, this is almost precisely the same thing i have, save for using POSIX character classes, str_pad instead of sprintf(), and incrementing elsewhere. What i was really wondering is if there was
a *much simpler* way to do this, not just re-arranging things.
Rob just gave you code that works better than what you did and you're
bitching about it?
Look, none of us are on your payroll so appreciate what you're given.
My advice, says thanks and if the code doesn't meet your expectations
then learn how to better phrase your question next time.
tedd
I wasn't bitching! And i *thought* that my numerous attempts at
explaining such would have been enough. Obviously not, but wtf can you
do with people who seem to want only to stir up ***?
Jim Lucas wrote:
Well, I didn't want to get into the middle of this cat fight, but now
that the talks have completely gotten off topic. I will
interject...
Perfect timing, then.
Here is a function that is a bit simpler then either of yours.
Now, if you plan to delete any images in the list, this will not work.
There's a daemon that locks the dir, zips up the contents, moves it
elsewhere, then removes everything at once.
<?php
function getNextImage($path, $prefix) { $filelist = glob("${path}${prefix}*") or return '01'; return str_pad(((int)count($filelist)+1), 2, '0', STR_PAD_LEFT); }
?>
Sweet! Thanks much!
brian
.
- Follow-Ups:
- Re: [PHP] counting with leading zeros
- From: tedd
- Re: [PHP] counting with leading zeros
- References:
- counting with leading zeros
- From: brian
- Re: [PHP] counting with leading zeros
- From: Robert Cummings
- Re: [PHP] counting with leading zeros
- From: brian
- Re: [PHP] counting with leading zeros
- From: tedd
- counting with leading zeros
- Prev by Date: SimpleXMLElement is not Simple
- Next by Date: Re: [PHP] SimpleXMLElement is not Simple
- Previous by thread: Re: [PHP] counting with leading zeros
- Next by thread: Re: [PHP] counting with leading zeros
- Index(es):