3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected function __construct() {} public static function create($name) { class_alias(get_called_class(), $name); return new $name(); } } $bar = Foo::create('Bar');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9jbd8
function name:  (null)
number of ops:  5
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_STATIC_METHOD_CALL                                  'Foo', 'create'
          1        SEND_VAL                                                 'Bar'
          2        DO_FCALL                                      0  $1      
          3        ASSIGN                                                   !0, $1
          4      > RETURN                                                   1

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9jbd8
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E > > RETURN                                                   null

End of function __construct

Function create:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9jbd8
function name:  create
number of ops:  11
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
   10     1        INIT_FCALL                                               'class_alias'
          2        GET_CALLED_CLASS                                 ~1      
          3        SEND_VAL                                                 ~1
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
   11     6        FETCH_CLASS                                   0  $3      !0
          7        NEW                                              $4      $3
          8        DO_FCALL                                      0          
          9      > RETURN                                                   $4
   12    10*     > RETURN                                                   null

End of function create

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
198.2 ms | 1400 KiB | 15 Q