Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
11 | public function generateRandomString( |
||
12 | int $length = 10, |
||
13 | string $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!#%^*()-_[]{}<>=/|$' |
||
14 | ): string { |
||
15 | $randomStr = ''; |
||
16 | for ($i = 0; $i < $length; $i++) { |
||
17 | $randomCharIndex = random_int(0, strlen($chars) - 1); |
||
18 | $randomStr .= $chars[$randomCharIndex]; |
||
19 | } |
||
20 | |||
21 | return $randomStr; |
||
22 | } |
||
23 | } |
||
24 |