3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface Test { public function selfRef(Test $other); } class TestImpl implements Test { public function selfRef(Test $other) { echo var_export($other, true) . PHP_EOL; } public function nonContractSelfRef(self $other) { echo var_export($other, true) . PHP_EOL; } } $a = new TestImpl(); $b = new TestImpl(); $a->selfRef($b);

preferences:
44.66 ms | 402 KiB | 5 Q