3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $name = 'foo'; public static function make() { $clazz = get_class(self); echo $clazz; return new $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/7d9Rt
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     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                                                 
   17     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/7d9Rt
function name:  make
number of ops:  9
compiled vars:  !0 = $clazz
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_CONSTANT                                   ~1      'self'
          1        GET_CLASS                                        ~2      ~1
          2        ASSIGN                                                   !0, ~2
    8     3        ECHO                                                     !0
    9     4        FETCH_CLASS                                   0  $4      !0
          5        NEW                                              $5      $4
          6        DO_FCALL                                      0          
          7      > RETURN                                                   $5
   10     8*     > 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/7d9Rt
function name:  make
number of ops:  9
compiled vars:  !0 = $clazz
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_CONSTANT                                   ~1      'self'
          1        GET_CLASS                                        ~2      ~1
          2        ASSIGN                                                   !0, ~2
    8     3        ECHO                                                     !0
    9     4        FETCH_CLASS                                   0  $4      !0
          5        NEW                                              $5      $4
          6        DO_FCALL                                      0          
          7      > RETURN                                                   $5
   10     8*     > RETURN                                                   null

End of function make

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.75 ms | 1396 KiB | 15 Q