Re: counting with leading zeros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 shit?

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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux