3v4l.org

run code in 300+ PHP versions simultaneously
<?php $class_aliases = [ 'FooAlias' => 'Foo' ]; spl_autoload_register(function($class) { var_dump($class); if (isset($class_aliases[$class])) { class_alias($class_aliases[$class], $class); return true; } }); class Foo {} class Bar extends Foo {} class FooCreator { public function create(FooAlias $foo) { } } $foo = new Bar; $creator = new FooCreator(); $alias = new FooAlias; var_dump($alias); $creator->create($foo);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oM65J
function name:  (null)
number of ops:  21
compiled vars:  !0 = $class_aliases, !1 = $foo, !2 = $creator, !3 = $alias
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    7     1        INIT_FCALL                                               'spl_autoload_register'
          2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FoM65J%3A7%240'
   13     3        SEND_VAL                                                 ~5
          4        DO_ICALL                                                 
   27     5        NEW                                              $7      'Bar'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $7
   28     8        NEW                                              $10     'FooCreator'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !2, $10
   30    11        NEW                                              $13     'FooAlias'
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !3, $13
   31    14        INIT_FCALL                                               'var_dump'
         15        SEND_VAR                                                 !3
         16        DO_ICALL                                                 
   33    17        INIT_METHOD_CALL                                         !2, 'create'
         18        SEND_VAR_EX                                              !1
         19        DO_FCALL                                      0          
         20      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FoM65J%3A7%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 12
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oM65J
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $class, !1 = $class_aliases
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
    9     4        ISSET_ISEMPTY_DIM_OBJ                         0          !1, !0
          5      > JMPZ                                                     ~3, ->12
   10     6    >   INIT_FCALL                                               'class_alias'
          7        FETCH_DIM_R                                      ~4      !1, !0
          8        SEND_VAL                                                 ~4
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
   11    11      > RETURN                                                   <true>
   13    12    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FoM65J%3A7%240

Class Foo: [no user functions]
Class Bar: [no user functions]
Class FooCreator:
Function create:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oM65J
function name:  create
number of ops:  2
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   23     1      > RETURN                                                   null

End of function create

End of class FooCreator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.05 ms | 1400 KiB | 19 Q