3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function longest_palendrome($string) { $words = explode(' ', $string); $longest = ''; foreach ($words as $word) { $letters = $reversed = explode('', $word); array_reverse($reversed); if ($letters === implode('', $reversed) && strlen($word) > strlen($longest)) { $longest = $word; } } return $word; } echo longest_palendrome("i ama racecar");
Output for 5.3.0 - 5.6.21, 7.0.0 - 7.1.0
Warning: explode(): Empty delimiter in /in/jJuJX on line 7 Warning: array_reverse() expects parameter 1 to be array, boolean given in /in/jJuJX on line 8 Warning: implode(): Invalid arguments passed in /in/jJuJX on line 9 Warning: explode(): Empty delimiter in /in/jJuJX on line 7 Warning: array_reverse() expects parameter 1 to be array, boolean given in /in/jJuJX on line 8 Warning: implode(): Invalid arguments passed in /in/jJuJX on line 9 Warning: explode(): Empty delimiter in /in/jJuJX on line 7 Warning: array_reverse() expects parameter 1 to be array, boolean given in /in/jJuJX on line 8 Warning: implode(): Invalid arguments passed in /in/jJuJX on line 9 racecar
Output for hhvm-3.10.0 - 3.12.0
Warning: Invalid argument: delimiter: (empty) in /in/jJuJX on line 7 Warning: array_reverse() expects parameter 1 to be array, boolean given in /in/jJuJX on line 8 Warning: Invalid operand type was used: implode() expects a container as one of the arguments in /in/jJuJX on line 9 Warning: Invalid argument: delimiter: (empty) in /in/jJuJX on line 7 Warning: array_reverse() expects parameter 1 to be array, boolean given in /in/jJuJX on line 8 Warning: Invalid operand type was used: implode() expects a container as one of the arguments in /in/jJuJX on line 9 Warning: Invalid argument: delimiter: (empty) in /in/jJuJX on line 7 Warning: array_reverse() expects parameter 1 to be array, boolean given in /in/jJuJX on line 8 Warning: Invalid operand type was used: implode() expects a container as one of the arguments in /in/jJuJX on line 9 racecar
Output for 5.2.5 - 5.2.17
Warning: explode(): Empty delimiter in /in/jJuJX on line 7 Warning: array_reverse(): The argument should be an array in /in/jJuJX on line 8 Warning: implode(): Invalid arguments passed in /in/jJuJX on line 9 Warning: explode(): Empty delimiter in /in/jJuJX on line 7 Warning: array_reverse(): The argument should be an array in /in/jJuJX on line 8 Warning: implode(): Invalid arguments passed in /in/jJuJX on line 9 Warning: explode(): Empty delimiter in /in/jJuJX on line 7 Warning: array_reverse(): The argument should be an array in /in/jJuJX on line 8 Warning: implode(): Invalid arguments passed in /in/jJuJX on line 9 racecar
Output for 5.2.3 - 5.2.4
Warning: explode(): Empty delimiter. in /in/jJuJX on line 7 Warning: array_reverse(): The argument should be an array in /in/jJuJX on line 8 Warning: implode(): Bad arguments. in /in/jJuJX on line 9 Warning: explode(): Empty delimiter. in /in/jJuJX on line 7 Warning: array_reverse(): The argument should be an array in /in/jJuJX on line 8 Warning: implode(): Bad arguments. in /in/jJuJX on line 9 Warning: explode(): Empty delimiter. in /in/jJuJX on line 7 Warning: array_reverse(): The argument should be an array in /in/jJuJX on line 8 Warning: implode(): Bad arguments. in /in/jJuJX on line 9 racecar
Output for 4.4.3 - 5.2.2
<br /> <b>Warning</b>: explode() [<a href='function.explode'>function.explode</a>]: Empty delimiter. in <b>/in/jJuJX</b> on line <b>7</b><br /> <br /> <b>Warning</b>: array_reverse() [<a href='function.array-reverse'>function.array-reverse</a>]: The argument should be an array in <b>/in/jJuJX</b> on line <b>8</b><br /> <br /> <b>Warning</b>: implode() [<a href='function.implode'>function.implode</a>]: Bad arguments. in <b>/in/jJuJX</b> on line <b>9</b><br /> <br /> <b>Warning</b>: explode() [<a href='function.explode'>function.explode</a>]: Empty delimiter. in <b>/in/jJuJX</b> on line <b>7</b><br /> <br /> <b>Warning</b>: array_reverse() [<a href='function.array-reverse'>function.array-reverse</a>]: The argument should be an array in <b>/in/jJuJX</b> on line <b>8</b><br /> <br /> <b>Warning</b>: implode() [<a href='function.implode'>function.implode</a>]: Bad arguments. in <b>/in/jJuJX</b> on line <b>9</b><br /> <br /> <b>Warning</b>: explode() [<a href='function.explode'>function.explode</a>]: Empty delimiter. in <b>/in/jJuJX</b> on line <b>7</b><br /> <br /> <b>Warning</b>: array_reverse() [<a href='function.array-reverse'>function.array-reverse</a>]: The argument should be an array in <b>/in/jJuJX</b> on line <b>8</b><br /> <br /> <b>Warning</b>: implode() [<a href='function.implode'>function.implode</a>]: Bad arguments. in <b>/in/jJuJX</b> on line <b>9</b><br /> racecar
Output for 4.3.2 - 4.4.2
<br /> <b>Warning</b>: explode(): Empty delimiter. in <b>/in/jJuJX</b> on line <b>7</b><br /> <br /> <b>Warning</b>: array_reverse(): The argument should be an array in <b>/in/jJuJX</b> on line <b>8</b><br /> <br /> <b>Warning</b>: implode(): Bad arguments. in <b>/in/jJuJX</b> on line <b>9</b><br /> <br /> <b>Warning</b>: explode(): Empty delimiter. in <b>/in/jJuJX</b> on line <b>7</b><br /> <br /> <b>Warning</b>: array_reverse(): The argument should be an array in <b>/in/jJuJX</b> on line <b>8</b><br /> <br /> <b>Warning</b>: implode(): Bad arguments. in <b>/in/jJuJX</b> on line <b>9</b><br /> <br /> <b>Warning</b>: explode(): Empty delimiter. in <b>/in/jJuJX</b> on line <b>7</b><br /> <br /> <b>Warning</b>: array_reverse(): The argument should be an array in <b>/in/jJuJX</b> on line <b>8</b><br /> <br /> <b>Warning</b>: implode(): Bad arguments. in <b>/in/jJuJX</b> on line <b>9</b><br /> racecar
Output for 4.3.0 - 4.3.1
<br /> <b>Warning</b>: explode() [<a href='http://www.php.net/function.explode'>function.explode</a>]: Empty delimiter. in <b>/in/jJuJX</b> on line <b>7</b><br /> <br /> <b>Warning</b>: array_reverse() [<a href='http://www.php.net/function.array-reverse'>function.array-reverse</a>]: The argument should be an array in <b>/in/jJuJX</b> on line <b>8</b><br /> <br /> <b>Warning</b>: implode() [<a href='http://www.php.net/function.implode'>function.implode</a>]: Bad arguments. in <b>/in/jJuJX</b> on line <b>9</b><br /> <br /> <b>Warning</b>: explode() [<a href='http://www.php.net/function.explode'>function.explode</a>]: Empty delimiter. in <b>/in/jJuJX</b> on line <b>7</b><br /> <br /> <b>Warning</b>: array_reverse() [<a href='http://www.php.net/function.array-reverse'>function.array-reverse</a>]: The argument should be an array in <b>/in/jJuJX</b> on line <b>8</b><br /> <br /> <b>Warning</b>: implode() [<a href='http://www.php.net/function.implode'>function.implode</a>]: Bad arguments. in <b>/in/jJuJX</b> on line <b>9</b><br /> <br /> <b>Warning</b>: explode() [<a href='http://www.php.net/function.explode'>function.explode</a>]: Empty delimiter. in <b>/in/jJuJX</b> on line <b>7</b><br /> <br /> <b>Warning</b>: array_reverse() [<a href='http://www.php.net/function.array-reverse'>function.array-reverse</a>]: The argument should be an array in <b>/in/jJuJX</b> on line <b>8</b><br /> <br /> <b>Warning</b>: implode() [<a href='http://www.php.net/function.implode'>function.implode</a>]: Bad arguments. in <b>/in/jJuJX</b> on line <b>9</b><br /> racecar