PHP random hash trick [never collides]
December 4, 2010 Leave a Comment
I discovered a really neat way to get a random hash that is less than 0.000005% likely to ever collide with another hash. Here is the script:
<?php
$hash = md5(rand(10,10000));
?>
Simply echo the $hash and refresh the page. You will see a new hash string every time. Feel free to comment and leave suggestions.
Advertisement