| Conditions | 2 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | function str_random($length = 16) |
||
| 35 | { |
||
| 36 | $string = ''; |
||
| 37 | |||
| 38 | while (($len = strlen($string)) < $length) { |
||
| 39 | $size = $length - $len; |
||
| 40 | $bytes = random_bytes($size); |
||
| 41 | $string .= substr(str_replace(['/', '+', '='], '', base64_encode($bytes)), 0, $size); |
||
| 42 | } |
||
| 43 | |||
| 44 | return $string; |
||
| 45 | } |
||
| 46 |