3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Base { function __construct() { echo ' Base'; } } class Extended extends Base { function __construct() { echo ' Extended'; } } class Extended2 extends Extended { function __construct() { echo ' Extended2'; } } $var1 = new Base(); $var2 = new Extended(); $var3 = new Extended2(); $var4 = $var1; new $var4; $var5 = clone $var3; new $var5;
based on F4nJI
Output for 5.3.19 - 7.2.0
Base Extended Extended2 Base Extended2