3v4l.org

run code in 300+ PHP versions simultaneously
<?php $class_aliases = [ 'FooAlias' => 'Foo' ]; spl_autoload_register(function($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/h50Fu
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%2Fh50Fu%3A7%240'
   12     3        SEND_VAL                                                 ~5
          4        DO_ICALL                                                 
   26     5        NEW                                              $7      'Bar'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $7
   27     8        NEW                                              $10     'FooCreator'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !2, $10
   29    11        NEW                                              $13     'FooAlias'
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !3, $13
   30    14        INIT_FCALL                                               'var_dump'
         15        SEND_VAR                                                 !3
         16        DO_ICALL                                                 
   32    17        INIT_METHOD_CALL                                         !2, 'create'
         18        SEND_VAR_EX                                              !1
         19        DO_FCALL                                      0          
         20      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2Fh50Fu%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/h50Fu
function name:  create
number of ops:  2
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   22     1      > RETURN                                                   null

End of function create

End of class FooCreator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.38 ms | 1400 KiB | 19 Q