With PHP 7 you can use this to generate a sufficiently random value based on the current timestamp:
$s = time() . bin2hex(random_bytes(10));
Do note that after 265 years (starting with 11 digits in 2286) the timestamp would get another digit, and sorting order will be off; if your code is expected to survive for that long, you may want to consider some padding.
Old answer
You can use a combination of uniqid()
and time()
like so:
$s = uniqid(time(), true);
Example output:
1346136883503c6b3330caf5.19553126