3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class myClass { } $obj = new myClass; $obj->color = function( $flower ){ $arr = ["rose"=>"red", "violet"=>"blue", "grass"=>"green"]; return $arr[$flower]; }; for ($flower = "rose";;){ if ($flower == "rose" || $flower == "blue" ){ echo "{$flower}s are ",($obj->color)($flower),"\n"; $flower = "violet"; } else { break; } }
based on koXRG
Output for 7.0.0 - 7.2.0
roses are red
Output for 5.4.11 - 5.6.28
Parse error: syntax error, unexpected '(', expecting ',' or ';' in /in/q9mGt on line 16
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/q9mGt on line 8
Process exited with code 255.