3v4l.org

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

Class Toto:
Function yielddata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/Io7Wi
function name:  yieldData
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   GENERATOR_CREATE                                         
    7     1        YIELD                                                    'a', 0
    9     2      > GENERATOR_RETURN                                         
   11     3*       YIELD                                                    'b', 0
   12     4*       YIELD                                                    'c', 0
   13     5*     > 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/Io7Wi
function name:  getData
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E > > RETURN                                                   <array>
   22     1*     > RETURN                                                   null

End of function getdata

End of class Toto.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.74 ms | 1396 KiB | 15 Q