Skip to content

Instantly share code, notes, and snippets.

@k1ic
Created November 3, 2016 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k1ic/cd6aea551f15f1d68de9acb00e80a422 to your computer and use it in GitHub Desktop.
Save k1ic/cd6aea551f15f1d68de9acb00e80a422 to your computer and use it in GitHub Desktop.
log id generate
sprintf("%u%04u", substr(sprintf("%.0f", microtime(true) * 1000000), 5), rand(0, 9999))
@k1ic
Copy link
Author

k1ic commented Nov 3, 2016

$now = microtime(true);
echo $now . "\n";
echo $now1000 . "\n";
echo $now
1000000 . "\n";
echo sprintf('%.0f', $now1000000) . "\n";
echo substr(sprintf('%.0f', $now
1000000), 5) . "\n";
echo sprintf('%u%04u', substr(sprintf('%.0f', $now*1000000), 5), rand(0, 9999)) , "\n";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment