3v4l.org

run code in 500+ PHP versions simultaneously
<?php spl_autoload_register(function($cname){ if ($cname == 'IMyInterface') { interface IMyInterface { // Use any class or interface constant as value of FOO. // I'll just use some constant available out of the box, to keep it simple: const FOO = FilesystemIterator::CURRENT_AS_PATHNAME; } } elseif ($cname == 'Foo') { class Foo implements IMyInterface {} } elseif ($cname == 'Bar') { class Bar extends Foo implements IMyInterface {} } }); // Foo is super-class for Bar. // uncomment below line to trigger the error: $F = new Foo(); // this should run without errors at any time, but if Foo is instantiated // prior to this line, then the error is triggered: $B = new Bar();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VpWO9
function name:  (null)
number of ops:  11
compiled vars:  !0 = $F, !1 = $B
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                                   'spl_autoload_register'
          1        DECLARE_LAMBDA_FUNCTION                              ~2      [0]
   14     2        SEND_VAL                                                     ~2
    2     3        DO_ICALL                                                     
   18     4        NEW                                                  $4      'Foo'
          5        DO_FCALL                                          0          
          6        ASSIGN                                                       !0, $4
   22     7        NEW                                                  $7      'Bar'
          8        DO_FCALL                                          0          
          9        ASSIGN                                                       !1, $7
         10      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/VpWO9
function name:  {closure:/in/VpWO9:2}
number of ops:  13
compiled vars:  !0 = $cname
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   RECV                                                 !0      
    3     1        IS_EQUAL                                                     !0, 'IMyInterface'
          2      > JMPZ                                                         ~1, ->5
    4     3    >   DECLARE_CLASS                                                'imyinterface'
    3     4      > JMP                                                          ->12
    9     5    >   IS_EQUAL                                                     !0, 'Foo'
          6      > JMPZ                                                         ~2, ->9
   10     7    >   DECLARE_CLASS                                                'foo'
    9     8      > JMP                                                          ->12
   11     9    >   IS_EQUAL                                                     !0, 'Bar'
         10      > JMPZ                                                         ~3, ->12
   12    11    >   DECLARE_CLASS                                                'bar', 'foo'
   14    12    > > RETURN                                                       null

End of Dynamic Function 0

Class IMyInterface: [no user functions]
Class Foo: [no user functions]
Class Bar: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.75 ms | 3298 KiB | 14 Q