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();