3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { public static function who(){ return __CLASS__; } static public function create($params = array()){ $class = static::who(); return new $class($params); } } class bar extends foo {} print_r(foo::create()); print_r(bar::create());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TkfQW
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'print_r'
          1        INIT_STATIC_METHOD_CALL                                  'foo', 'create'
          2        DO_FCALL                                      0  $0      
          3        SEND_VAR                                                 $0
          4        DO_ICALL                                                 
   15     5        INIT_FCALL                                               'print_r'
          6        INIT_STATIC_METHOD_CALL                                  'bar', 'create'
          7        DO_FCALL                                      0  $2      
          8        SEND_VAR                                                 $2
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

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

End of function who

Function create:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TkfQW
function name:  create
number of ops:  10
compiled vars:  !0 = $params, !1 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV_INIT                                        !0      <array>
    7     1        INIT_STATIC_METHOD_CALL                                  'who'
          2        DO_FCALL                                      0  $2      
          3        ASSIGN                                                   !1, $2
    8     4        FETCH_CLASS                                   0  $4      !1
          5        NEW                                              $5      $4
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0          
          8      > RETURN                                                   $5
    9     9*     > RETURN                                                   null

End of function create

End of class foo.

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

End of function who

Function create:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TkfQW
function name:  create
number of ops:  10
compiled vars:  !0 = $params, !1 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV_INIT                                        !0      <array>
    7     1        INIT_STATIC_METHOD_CALL                                  'who'
          2        DO_FCALL                                      0  $2      
          3        ASSIGN                                                   !1, $2
    8     4        FETCH_CLASS                                   0  $4      !1
          5        NEW                                              $5      $4
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0          
          8      > RETURN                                                   $5
    9     9*     > RETURN                                                   null

End of function create

End of class bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.27 ms | 1400 KiB | 15 Q