3v4l.org

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

Class Foo:
Function create:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ks67J
function name:  create
number of ops:  8
compiled vars:  !0 = $class, !1 = $inst
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   GET_CALLED_CLASS                                 ~2      
          1        ASSIGN                                                   !0, ~2
    6     2        FETCH_CLASS                                   0  $4      !0
          3        NEW                                              $5      $4
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
    7     6      > RETURN                                                   !1
    8     7*     > RETURN                                                   null

End of function create

End of class Foo.

Class Bar:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ks67J
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_STATIC_METHOD_CALL                                  'constsssdfvdruct'
          1        DO_FCALL                                      0          
   14     2      > 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/ks67J
function name:  create
number of ops:  8
compiled vars:  !0 = $class, !1 = $inst
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   GET_CALLED_CLASS                                 ~2      
          1        ASSIGN                                                   !0, ~2
    6     2        FETCH_CLASS                                   0  $4      !0
          3        NEW                                              $5      $4
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
    7     6      > RETURN                                                   !1
    8     7*     > RETURN                                                   null

End of function create

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.03 ms | 1396 KiB | 15 Q