3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $clazz = new class { public $foo = null; }; $clazzy = new $clazz(); $clazzy->fooo = "bar"; var_dump($clazz, $clazzy);
Output for 7.0.0 - 7.3.1
object(class@anonymous)#1 (1) { ["foo"]=> NULL } object(class@anonymous)#2 (2) { ["foo"]=> NULL ["fooo"]=> string(3) "bar" }
Output for hhvm-3.17.3
object(class@anonymous$;2)#1 (1) { ["foo"]=> NULL } object(class@anonymous$;2)#2 (2) { ["foo"]=> NULL ["fooo"]=> string(3) "bar" }
Output for hhvm-3.12.14 - 3.15.4
object(class@anonymous$;1930627636)#1 (1) { ["foo"]=> NULL } object(class@anonymous$;1930627636)#2 (2) { ["foo"]=> NULL ["fooo"]=> string(3) "bar" }
Output for 5.6.0 - 5.6.30
Parse error: syntax error, unexpected 'class' (T_CLASS) in /in/opivb on line 3
Process exited with code 255.