3v4l.org

run code in 300+ PHP versions simultaneously
<?php $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789"; $pass = array(); //remember to declare $pass as an array $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache for ($i = 0; $i < $codeLength; $i++) { $n = rand(0, $alphaLength); $pass[] = $alphabet[$n]; } return implode($pass); //turn the array into a string
Output for 5.0.4 - 5.0.5, 5.1.1 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.37, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.7
Notice: Undefined variable: codeLength in /in/QdeNf on line 5
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/QdeNf on line 9
Process exited with code 255.
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.3
Notice: Undefined variable: codeLength in /in/QdeNf on line 5

preferences:
180.55 ms | 402 KiB | 210 Q