3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { const B = 'A::B is a constant'.PHP_EOL; } class C { const B = 'C::B is a constant'.PHP_EOL; } const C = new A; echo C::B; // C is the class echo (C)::B; // C is the constant // C is a class here var_dump(new C instanceof C); // (C) is the constant, var_dump(new C instanceof (C)); // instanceof works with objects too var_dump(new C instanceof (new C)); // but this is invalid syntax //var_dump(new C instanceof new C); ?>
Output for git.master, git.master_jit
C::B is a constant A::B is a constant bool(true) bool(false) bool(true)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
55.3 ms | 854 KiB | 5 Q