Skip to content

Instantly share code, notes, and snippets.

@chihirokaasan
Last active November 7, 2016 08:42
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 chihirokaasan/f00a5917b41c34c4a2ed45f246bb8ee3 to your computer and use it in GitHub Desktop.
Save chihirokaasan/f00a5917b41c34c4a2ed45f246bb8ee3 to your computer and use it in GitHub Desktop.
<?php
//ついでに非 Laravelerの人のためにランダムなパスワード生成
private function makeRandomPassword()
{
$collectionA = array_rand(array_flip(range('a', 'z')), 4);
$collectionB = array_rand(array_flip(range('A', 'Z')), 4);
$collectionC = array_rand(array_flip(range(0, 9)), 3);
$collectionD = array_rand(array_flip(['!','$','%','&','(',')','*','+','/']), 3);
$passwordstr = array_merge($collectionA,$collectionB,$collectionC,$collectionD);
return str_shuffle(implode($passwordstr));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment