3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { public function get(): iterable { return [17]; } } class B extends A { public function get(): iterable { yield 42; } } echo (new A)->get()[0]; echo (new B)->get()[0];
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l9NY2
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   NEW                                                  $0      'A'
          1        DO_FCALL                                          0          
          2        INIT_METHOD_CALL                                             $0, 'get'
          3        DO_FCALL                                          0  $2      
          4        FETCH_DIM_R                                          ~3      $2, 0
          5        ECHO                                                         ~3
   15     6        NEW                                                  $4      'B'
          7        DO_FCALL                                          0          
          8        INIT_METHOD_CALL                                             $4, 'get'
          9        DO_FCALL                                          0  $6      
         10        FETCH_DIM_R                                          ~7      $6, 0
         11        ECHO                                                         ~7
         12      > RETURN                                                       1

Class A:
Function get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l9NY2
function name:  get
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E > > RETURN                                                       <array>
    5     1*       VERIFY_RETURN_TYPE                                           
          2*     > RETURN                                                       null

End of function get

End of class A.

Class B:
Function get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/l9NY2
function name:  get
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   GENERATOR_CREATE                                             
   10     1        YIELD                                                        42
   11     2      > GENERATOR_RETURN                                             

End of function get

End of class B.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
171.48 ms | 1462 KiB | 13 Q