Skip to content

Instantly share code, notes, and snippets.

@NewEXE
Last active May 12, 2020 10:00
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 NewEXE/f40273a445adf63a746098a718d6445c to your computer and use it in GitHub Desktop.
Save NewEXE/f40273a445adf63a746098a718d6445c to your computer and use it in GitHub Desktop.
PHP random funtion
<?php
// From old versions of Laravel
// Don't use in cryptography
function str_random($length = 16)
{
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
return substr(str_shuffle(str_repeat($pool, $length)), 0, $length);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment