Skip to content

Instantly share code, notes, and snippets.

@alpenzoo
Created April 16, 2018 06:41
Show Gist options
  • Save alpenzoo/24302bad322e5de4a2dfb8c8c705c619 to your computer and use it in GitHub Desktop.
Save alpenzoo/24302bad322e5de4a2dfb8c8c705c619 to your computer and use it in GitHub Desktop.
<?php
$seed = str_split('abcdefghijklmnopqrstuvwxyz'
.'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
.'0123456789!@#$%^&*()'); // and any other characters
shuffle($seed); // probably optional since array_is randomized; this may be redundant
$rand = '';
foreach (array_rand($seed, 5) as $k) $rand .= $seed[$k];
echo $rand;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment