3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { function __construct() { $this->foo = new B; } } class B { static $c = 0; function construct() { $this->i = ++self::$c; } } $a = new A; $b = clone $a; var_dump($a, $b);

preferences:
35.13 ms | 402 KiB | 5 Q