3v4l.org

run code in 300+ PHP versions simultaneously
<?php private function rand_str($length = 8, $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890') { $chars_length = (strlen($chars) - 1); $string = $chars{rand(0, $chars_length)}; for ($i = 1; $i < $length; $i = strlen($string)) { $r = $chars{rand(0, $chars_length)}; if ($r != $string{$i - 1}) { $string .= $r; } } return $string; }
Output for 5.4.0 - 5.4.27, 5.5.0 - 5.5.11
Parse error: syntax error, unexpected 'private' (T_PRIVATE) in /in/stCCG on line 2
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_PRIVATE in /in/stCCG on line 2
Process exited with code 255.

preferences:
210.01 ms | 1395 KiB | 76 Q