3v4l.org

run code in 300+ PHP versions simultaneously
<?php class TheParent { public static function build(): TheParent { return new static(); } } class Child extends TheParent {} $child = Child::build(); $parent = TheParent::build(); echo get_class($child), "\n"; echo get_class($parent), "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RBZjZ
function name:  (null)
number of ops:  13
compiled vars:  !0 = $child, !1 = $parent
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_STATIC_METHOD_CALL                                  'Child', 'build'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   14     3        INIT_STATIC_METHOD_CALL                                  'TheParent', 'build'
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !1, $4
   16     6        GET_CLASS                                        ~6      !0
          7        ECHO                                                     ~6
          8        ECHO                                                     '%0A'
   17     9        GET_CLASS                                        ~7      !1
         10        ECHO                                                     ~7
         11        ECHO                                                     '%0A'
         12      > RETURN                                                   1

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

End of function build

End of class TheParent.

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

End of function build

End of class Child.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.67 ms | 998 KiB | 13 Q