3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface HasTest { public function test(); } class TestClass implements HasTest { public function test() { return 'This is a quick test'; } } $test = array ( 'test' => TestClass ); // !! Using instanceof var_dump($test['test'] instanceof HasTest); var_dump(TestClass instanceof HasTest); // !! Using class_implements var_dump(in_array('HasTest', class_implements($test['test']))); /** * Output: * * bool(false) * bool(false) * bool(true) */ $class = new $test['test']; var_dump($class instanceof HasTest); /** * Output: * bool(true) */
Output for git.master, rfc.property-hooks, git.master_jit
Fatal error: Uncaught Error: Undefined constant "TestClass" in /in/QTm9L:14 Stack trace: #0 {main} thrown in /in/QTm9L on line 14
Process exited with code 255.

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:
35.59 ms | 2416 KiB | 4 Q