3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Toto { public function yieldData() { yield 0 => 'a'; yield 0 => 'b'; yield 0 => 'c'; } public function getData() { return [ 'a', 'b', 'c', ]; } } $toto = new Toto(); $data = $toto->getData(); var_dump($data); foreach ($toto->yieldData() as $i => $data) { var_dump($i, $data); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 19
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 19
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/hNHnA
function name:  (null)
number of ops:  21
compiled vars:  !0 = $toto, !1 = $data, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $3      'Toto'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   24     3        INIT_METHOD_CALL                                         !0, 'getData'
          4        DO_FCALL                                      0  $6      
          5        ASSIGN                                                   !1, $6
   25     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                                 
   27     9        INIT_METHOD_CALL                                         !0, 'yieldData'
         10        DO_FCALL                                      0  $9      
         11      > FE_RESET_R                                       $10     $9, ->19
         12    > > FE_FETCH_R                                       ~11     $10, !1, ->19
         13    >   ASSIGN                                                   !2, ~11
   28    14        INIT_FCALL                                               'var_dump'
         15        SEND_VAR                                                 !2
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                                 
   27    18      > JMP                                                      ->12
         19    >   FE_FREE                                                  $10
   29    20      > RETURN                                                   1

Class Toto:
Function yielddata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/hNHnA
function name:  yieldData
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   GENERATOR_CREATE                                         
    7     1        YIELD                                                    'a', 0
    8     2        YIELD                                                    'b', 0
    9     3        YIELD                                                    'c', 0
   10     4      > GENERATOR_RETURN                                         

End of function yielddata

Function getdata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hNHnA
function name:  getData
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E > > RETURN                                                   <array>
   19     1*     > RETURN                                                   null

End of function getdata

End of class Toto.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.37 ms | 1396 KiB | 15 Q