php random filename generator

Solutions on MaxInterview for php random filename generator by the best coders in the world

showing results for - "php random filename generator"
Hannes
18 Jun 2019
1function random_string($length) {
2    $key = '';
3    $keys = array_merge(range(0, 9), range('a', 'z'));
4
5    for ($i = 0; $i < $length; $i++) {
6        $key .= $keys[array_rand($keys)];
7    }
8
9    return $key;
10}
11//
12echo random_string(50);
13