3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function insert_random_chars($str, $alphabet = "ABCDEFGHIJKLMNOPGRSTUVWXYZ") { // An array to hold the result $result = array(); // The highest character index in the string $max = strlen($alphabet) - 1; // Loop the characters in the input string foreach (str_split($str, 1) as $char) { // Add the current character and a random character to the output array array_push($result, $char, $alphabet[mt_rand(0, $max)]; } // Join the output array together return implode('', $result); } echo insert_random_chars("0123456789");
Output for 5.3.0 - 5.4.21
Parse error: syntax error, unexpected ';' in /in/mvCfS on line 14
Process exited with code 255.