3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class A { public function printName() { echo 'A'; } } class B extends A { public function printName() { echo 'B'; } } class C extends A { public function printName() { echo 'C'; } } $classes = array( new A(), (A)new B(), (A)new C() ); foreach($classes as $class) { $class->printName() . "\n"; }
Output for 5.4.0 - 5.5.12
Parse error: syntax error, unexpected 'new' (T_NEW), expecting ')' in /in/oPOiO on line 25
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_NEW, expecting ')' in /in/oPOiO on line 25
Process exited with code 255.