Skip to content

Instantly share code, notes, and snippets.

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 abdullahbutt/76fef6c936e911d34d46806f563d11d5 to your computer and use it in GitHub Desktop.
Save abdullahbutt/76fef6c936e911d34d46806f563d11d5 to your computer and use it in GitHub Desktop.
generating random alphanumeric strings in php
<?php
// https://code.tutsplus.com/tutorials/generate-random-alphanumeric-strings-in-php--cms-32132
//$permitted_chars = '0123456789abcdefghijklmnopqrstuvwxyz';
$permitted_chars = '0123456789abcdefghijklmnopqrstuvwxyz!@#%';
// Output: 54esmdr0qf
$password = substr(str_shuffle($permitted_chars), 0, 8);
echo $password;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment