3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected function __construct() {} public static function create($name) { class_alias('Foo', $name); return new $name(); } } $bar = Foo::create('Bar'); var_dump($bar instanceof Bar);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UkSE3
function name:  (null)
number of ops:  9
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
   17     4        INIT_FCALL                                               'var_dump'
          5        INSTANCEOF                                       ~3      !0, 'Bar'
          6        SEND_VAL                                                 ~3
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UkSE3
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/UkSE3
function name:  create
number of ops:  10
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        SEND_VAL                                                 'Foo'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
   11     5        FETCH_CLASS                                   0  $2      !0
          6        NEW                                              $3      $2
          7        DO_FCALL                                      0          
          8      > RETURN                                                   $3
   12     9*     > RETURN                                                   null

End of function create

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.87 ms | 1395 KiB | 17 Q