3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function longest_palendrome($string) { $words = split(' ', $string); $longest = ''; foreach ($words as $word) { $letters = $reversed = split('', $word); array_reverse($reversed); if ($letters === join('', $reversed) && strlen($word) > strlen($longest)) { $longest = $word; } } return $word; } echo longest_palendrome("i ama racecar");
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to undefined function split() in /in/3bS6S:4 Stack trace: #0 /in/3bS6S(17): longest_palendrome('i ama racecar') #1 {main} thrown in /in/3bS6S on line 4
Process exited with code 255.
Output for hhvm-3.10.0 - 3.13.2
Warning: Invalid Regular Expression to split() in /in/3bS6S on line 7 Warning: array_reverse() expects parameter 1 to be array, boolean given in /in/3bS6S on line 8 Warning: Invalid operand type was used: implode() expects a container as one of the arguments in /in/3bS6S on line 9 Warning: Invalid Regular Expression to split() in /in/3bS6S on line 7 Warning: array_reverse() expects parameter 1 to be array, boolean given in /in/3bS6S on line 8 Warning: Invalid operand type was used: implode() expects a container as one of the arguments in /in/3bS6S on line 9 Warning: Invalid Regular Expression to split() in /in/3bS6S on line 7 Warning: array_reverse() expects parameter 1 to be array, boolean given in /in/3bS6S on line 8 Warning: Invalid operand type was used: implode() expects a container as one of the arguments in /in/3bS6S on line 9 racecar
Output for 5.3.0 - 5.6.26
Deprecated: Function split() is deprecated in /in/3bS6S on line 4 Deprecated: Function split() is deprecated in /in/3bS6S on line 7 Warning: split(): REG_EMPTY in /in/3bS6S on line 7 Warning: array_reverse() expects parameter 1 to be array, boolean given in /in/3bS6S on line 8 Warning: join(): Invalid arguments passed in /in/3bS6S on line 9 Deprecated: Function split() is deprecated in /in/3bS6S on line 7 Warning: split(): REG_EMPTY in /in/3bS6S on line 7 Warning: array_reverse() expects parameter 1 to be array, boolean given in /in/3bS6S on line 8 Warning: join(): Invalid arguments passed in /in/3bS6S on line 9 Deprecated: Function split() is deprecated in /in/3bS6S on line 7 Warning: split(): REG_EMPTY in /in/3bS6S on line 7 Warning: array_reverse() expects parameter 1 to be array, boolean given in /in/3bS6S on line 8 Warning: join(): Invalid arguments passed in /in/3bS6S on line 9 racecar
Output for 5.2.5 - 5.2.17
Warning: split(): REG_EMPTY in /in/3bS6S on line 7 Warning: array_reverse(): The argument should be an array in /in/3bS6S on line 8 Warning: join(): Invalid arguments passed in /in/3bS6S on line 9 Warning: split(): REG_EMPTY in /in/3bS6S on line 7 Warning: array_reverse(): The argument should be an array in /in/3bS6S on line 8 Warning: join(): Invalid arguments passed in /in/3bS6S on line 9 Warning: split(): REG_EMPTY in /in/3bS6S on line 7 Warning: array_reverse(): The argument should be an array in /in/3bS6S on line 8 Warning: join(): Invalid arguments passed in /in/3bS6S on line 9 racecar
Output for 4.3.2 - 5.2.4
Warning: split(): REG_EMPTY in /in/3bS6S on line 7 Warning: array_reverse(): The argument should be an array in /in/3bS6S on line 8 Warning: join(): Bad arguments. in /in/3bS6S on line 9 Warning: split(): REG_EMPTY in /in/3bS6S on line 7 Warning: array_reverse(): The argument should be an array in /in/3bS6S on line 8 Warning: join(): Bad arguments. in /in/3bS6S on line 9 Warning: split(): REG_EMPTY in /in/3bS6S on line 7 Warning: array_reverse(): The argument should be an array in /in/3bS6S on line 8 Warning: join(): Bad arguments. in /in/3bS6S on line 9 racecar
Output for 4.3.0 - 4.3.1
Warning: split() [http://www.php.net/function.split]: REG_EMPTY in /in/3bS6S on line 7 Warning: array_reverse() [http://www.php.net/function.array-reverse]: The argument should be an array in /in/3bS6S on line 8 Warning: join() [http://www.php.net/function.join]: Bad arguments. in /in/3bS6S on line 9 Warning: split() [http://www.php.net/function.split]: REG_EMPTY in /in/3bS6S on line 7 Warning: array_reverse() [http://www.php.net/function.array-reverse]: The argument should be an array in /in/3bS6S on line 8 Warning: join() [http://www.php.net/function.join]: Bad arguments. in /in/3bS6S on line 9 Warning: split() [http://www.php.net/function.split]: REG_EMPTY in /in/3bS6S on line 7 Warning: array_reverse() [http://www.php.net/function.array-reverse]: The argument should be an array in /in/3bS6S on line 8 Warning: join() [http://www.php.net/function.join]: Bad arguments. in /in/3bS6S on line 9 racecar