Created
November 22, 2018 09:12
-
-
Save chrismademe/2c7e9b5ee410899314857b5f14275537 to your computer and use it in GitHub Desktop.
Random String in PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$permitted_chars = '0123456789abcdefghijklmnopqrstuvwxyz'; | |
// Output: 54esmdr0qf | |
echo substr(str_shuffle($permitted_chars), 0, 10); | |
$permitted_chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
// Output: video-g6swmAP8X5VG4jCi.mp4 | |
echo 'video-'.substr(str_shuffle($permitted_chars), 0, 16).'.mp4'; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment