3v4l.org

run code in 300+ PHP versions simultaneously
<?php $depth = 0; spl_autoload_register(function ($class) use (&$depth) { $depth++; $indent = str_repeat('| ', $depth); echo $indent."$depth: $class\n"; if ($class == 'IFace') { interface IFace {} } elseif ($class == 'IFaceImplementor') { class IFaceImplementor implements IFace {} } elseif ($class == 'InterfaceOfMainParent') { interface InterfaceOfMainParent { public function methodForSecondaryLspCheck(): IFace; } } elseif ($class == 'MainParent') { abstract class MainParent implements InterfaceOfMainParent { public function methodForSecondaryLspCheck(): IFaceImplementor {} } } elseif ($class == 'Intermediate') { abstract class Intermediate extends MainParent {} } elseif ($class == 'Child1') { class Child1 extends Intermediate {} } elseif ($class == 'Child2') { class Child2 extends Intermediate {} } elseif ($class == 'EntrypointParent') { abstract class EntrypointParent { abstract public function methodForLspCheck1(): MainParent; abstract public function methodForLspCheck2(): MainParent; } } elseif ($class == 'Entrypoint') { class Entrypoint extends EntrypointParent { public function methodForLspCheck1(): Child1 {} public function methodForLspCheck2(): Child2 {} } } $depth--; }); class_exists(Entrypoint::class);
Output for git.master, git.master_jit
| 1: Entrypoint | | 2: EntrypointParent | | 2: Child1 | | | 3: Intermediate | | | | 4: MainParent | | | | | 5: InterfaceOfMainParent | | | | | 5: Child2 Fatal error: During inheritance of MainParent, while autoloading Child2: Uncaught Error: Class "Intermediate" not found in /in/G5fFe:31 Stack trace: #0 /in/G5fFe(22): {closure:/in/G5fFe:7}('Child2') #1 /in/G5fFe(27): {closure:/in/G5fFe:7}('MainParent') #2 /in/G5fFe(29): {closure:/in/G5fFe:7}('Intermediate') #3 /in/G5fFe(39): {closure:/in/G5fFe:7}('Child1') #4 [internal function]: {closure:/in/G5fFe:7}('Entrypoint') #5 /in/G5fFe(49): class_exists('Entrypoint') #6 {main} in /in/G5fFe on line 22 Stack trace: #0 /in/G5fFe(27): {closure:/in/G5fFe:7}('MainParent') #1 /in/G5fFe(29): {closure:/in/G5fFe:7}('Intermediate') #2 /in/G5fFe(39): {closure:/in/G5fFe:7}('Child1') #3 [internal function]: {closure:/in/G5fFe:7}('Entrypoint') #4 /in/G5fFe(49): class_exists('Entrypoint') #5 {main}
Process exited with code 255.
Output for rfc.property-hooks
| 1: Entrypoint | | 2: EntrypointParent | | 2: Child1 | | | 3: Intermediate | | | | 4: MainParent | | | | | 5: InterfaceOfMainParent | | | | | 5: Child2 Fatal error: During inheritance of MainParent, while autoloading Child2: Uncaught Error: Class "Intermediate" not found in /in/G5fFe:31 Stack trace: #0 /in/G5fFe(22): {closure}('Child2') #1 /in/G5fFe(27): {closure}('MainParent') #2 /in/G5fFe(29): {closure}('Intermediate') #3 /in/G5fFe(39): {closure}('Child1') #4 [internal function]: {closure}('Entrypoint') #5 /in/G5fFe(49): class_exists('Entrypoint') #6 {main} in /in/G5fFe on line 22
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:
25.7 ms | 408 KiB | 5 Q