Create random hash with PHP

The following php script will create and echo a 8 digit long string containing random letters and numbers.


$pass_rnd = array_merge(range('a','z'), range('A','Z'), range(0,9));
$rnd = array_rand($pass_rnd, 8);
$random_hash = "";
for($i=1;$i<=8;$i++) {
 $random_hash .= $pass_rnd[$rnd[$i]];
$random_hash = str_shuffle($random_hash);
echo $random_hash;

Go Daddy

Related articles

Redirect www to non www with .htaccess RewriteRule

Redirect www to non www with .htaccess RewriteRule


Redirect your websites visitors from to without www.

Email Validation

Email Validation


Learn how to validate email on client side with HTML5, Javascript and on server side with PHP.

Generate Thumbnail on the Fly with PHP

Generate Thumbnail on the Fly with PHP


In a previous artice I already showed you how to generate square thumbnails with PHP. Now I show you how to keep the original ratio of the image and how to control the alignment of the square image.

Leave a comment

We welcome any comment from you! Please keep in mind that comments are moderated and rel='nofollow' is in use. So, please do not use a domain as your name or a spammy keyword, or your comment will be deleted.

Name: *

E-mail: *

Message: *

Click on the airplane *

Find us on Facebook


Get online with the world's Best -!

Back to Top