3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function v1($first, $last) { $result = trim($first); $lastName = trim($last); if ($lastName) { if (!empty($result)) { $result .= ' '; } $result .= $lastName; } return $result; } function v2($first, $last) { return implode(" ", [trim($first), trim($last)]); } function v($first, $last) { echo v1($first, $last); echo PHP_EOL; echo v2($first, $last); } v();
Output for 7.1.0 - 7.2.0
Fatal error: Uncaught ArgumentCountError: Too few arguments to function v(), 0 passed in /in/p1RP2 on line 29 and exactly 2 expected in /in/p1RP2:22 Stack trace: #0 /in/p1RP2(29): v() #1 {main} thrown in /in/p1RP2 on line 22
Process exited with code 255.
Output for 5.4.0 - 7.0.20
Warning: Missing argument 1 for v(), called in /in/p1RP2 on line 29 and defined in /in/p1RP2 on line 22 Warning: Missing argument 2 for v(), called in /in/p1RP2 on line 29 and defined in /in/p1RP2 on line 22 Notice: Undefined variable: first in /in/p1RP2 on line 24 Notice: Undefined variable: last in /in/p1RP2 on line 24 Notice: Undefined variable: first in /in/p1RP2 on line 26 Notice: Undefined variable: last in /in/p1RP2 on line 26
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/p1RP2 on line 19
Process exited with code 255.