3v4l.org

run code in 300+ PHP versions simultaneously
<?php spl_autoload_register(function ($class) { if ('Foo' === $class) { class Foo implements Foointerface {} } elseif ('Foointerface' === $class) { throw new Exception(); } }); try { // First call triggers the autoloader new Foo(); } catch (Exception $e) {} // For the second call Foo is loaded var_dump(new Foo()); // Even though it’s missing the interface var_dump(new Foo() instanceof Foointerface); var_dump((new ReflectionClass('Foo'))->getInterfaces());
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Exception in /in/s8ti7:7 Stack trace: #0 /in/s8ti7(5): {closure}('Foointerface') #1 /in/s8ti7(17): {closure}('Foo') #2 {main} thrown in /in/s8ti7 on line 7
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:
61.5 ms | 401 KiB | 8 Q