in reply to Generating Random Filenames
From the top of my head, I'd go with something like:
$filename = time . "_${$}_" . (int rand(1024));
The method you're proposing might be enough for what you're doing, but if you have the process running hundreds of times, you still have the possibility of failure.
With the code I presented you, the only possibility of failure involves running the same process id twice at the same moment (only possible on very icky OS's that are not finished yet (I believe) or if you change the date/time of the machine and then bump into the same process id in the very same exact moment!
And still, the rand(1024) would have to output the same value again :-)
|
|---|