3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $poor_geek = "H A R R Y P O T T E R"; $voldemort = "Lord Voldemort"; function avada_kedavra(string $fullname): string { if (strpos($fullname, " ") !== false) $fullname = preg_replace("{ (?! )}", "", $fullname); return strtok($fullname, " "); } echo avada_kedavra($poor_geek), " is dead\n"; echo avada_kedavra($voldemort), " cannot die\n";
based on r1g3h
Output for hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.2.6
HARRY is dead Lord cannot die
Output for 5.6.0 - 5.6.30
Parse error: syntax error, unexpected ':', expecting '{' in /in/nepbd on line 6
Process exited with code 255.