3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL & ~E_STRICT); class A { public function create() { return new static(); } } class B { public function meh() { return A::create(); } } $b = new B; echo get_class($b->meh()); // B ?
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uYfCv
function name:  (null)
number of ops:  11
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 30719
          2        DO_ICALL                                                 
   22     3        NEW                                              $2      'B'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
   23     6        INIT_METHOD_CALL                                         !0, 'meh'
          7        DO_FCALL                                      0  $5      
          8        GET_CLASS                                        ~6      $5
          9        ECHO                                                     ~6
         10      > RETURN                                                   1

Class A:
Function create:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uYfCv
function name:  create
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   NEW                          static              $0      
          1        DO_FCALL                                      0          
          2      > RETURN                                                   $0
   10     3*     > RETURN                                                   null

End of function create

End of class A.

Class B:
Function meh:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uYfCv
function name:  meh
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_STATIC_METHOD_CALL                                  'A', 'create'
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
   18     3*     > RETURN                                                   null

End of function meh

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.48 ms | 1400 KiB | 15 Q