3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Toto { public function yieldData() { yield 'a'; yield 'b'; yield 'c'; } public function getData() { return [ 'a', 'b', 'c', ]; } } $toto = new Toto(); $data = $toto->getData(); var_dump($data); foreach ($data as $i => $data) { var_dump($i, $data); } var_dump($toto->yieldData()); var_dump($toto->yieldData());
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 17
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/vuGCr
function name:  (null)
number of ops:  29
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      > FE_RESET_R                                       $9      !1, ->17
         10    > > FE_FETCH_R                                       ~10     $9, !1, ->17
         11    >   ASSIGN                                                   !2, ~10
   28    12        INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !2
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                                 
   27    16      > JMP                                                      ->10
         17    >   FE_FREE                                                  $9
   31    18        INIT_FCALL                                               'var_dump'
         19        INIT_METHOD_CALL                                         !0, 'yieldData'
         20        DO_FCALL                                      0  $13     
         21        SEND_VAR                                                 $13
         22        DO_ICALL                                                 
   32    23        INIT_FCALL                                               'var_dump'
         24        INIT_METHOD_CALL                                         !0, 'yieldData'
         25        DO_FCALL                                      0  $15     
         26        SEND_VAR                                                 $15
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Class Toto:
Function yielddata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/vuGCr
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'
    8     2        YIELD                                                    'b'
    9     3        YIELD                                                    'c'
   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/vuGCr
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:
158.43 ms | 1400 KiB | 15 Q