3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo() { return new class{}; } function bar() { return new class{}; } $a = foo(); $b = foo(); $x = bar(); var_dump($a instanceof $b); var_dump($b instanceof $a); var_dump($a instanceof $x); var_dump($x instanceof $a);
Output for 7.4.0 - 7.4.32, 8.0.1 - 8.0.24, 8.1.0 - 8.1.11
bool(true) bool(true) bool(false) bool(false)

preferences:
37.03 ms | 409 KiB | 5 Q