3v4l.org

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

Class Foo:
Function make:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dNZY4
function name:  make
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_THIS                                       $0      
          1        FETCH_THIS                                       ~2      
          2        GET_CLASS                                        ~3      ~2
          3        ASSIGN_OBJ                                               $0, 'clazz'
          4        OP_DATA                                                  ~3
    8     5        FETCH_THIS                                       $4      
          6        FETCH_OBJ_R                                      ~5      $4, 'clazz'
          7        FETCH_CLASS                                   0  $6      ~5
          8        NEW                                              $7      $6
          9        DO_FCALL                                      0          
         10      > RETURN                                                   $7
    9    11*     > RETURN                                                   null

End of function make

End of class Foo.

Class Bar:
Function make:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dNZY4
function name:  make
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_THIS                                       $0      
          1        FETCH_THIS                                       ~2      
          2        GET_CLASS                                        ~3      ~2
          3        ASSIGN_OBJ                                               $0, 'clazz'
          4        OP_DATA                                                  ~3
    8     5        FETCH_THIS                                       $4      
          6        FETCH_OBJ_R                                      ~5      $4, 'clazz'
          7        FETCH_CLASS                                   0  $6      ~5
          8        NEW                                              $7      $6
          9        DO_FCALL                                      0          
         10      > RETURN                                                   $7
    9    11*     > RETURN                                                   null

End of function make

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.64 ms | 1396 KiB | 15 Q