3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); namespace App; use Generator; use CachingIterator; $generator = /** * @return Generator<bool, bool> */ static function (): Generator { yield true => true; yield false => false; }; $iterator = new CachingIterator($generator()); foreach ($iterator as $k => $v) { var_dump($k, $v); } foreach ($iterator->getCache() as $k => $v) { var_dump($k, $v); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 16
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 27
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 27
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
Branch analysis from position: 16
filename:       /in/a0Uc7
function name:  (null)
number of ops:  29
compiled vars:  !0 = $generator, !1 = $iterator, !2 = $v, !3 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   DECLARE_LAMBDA_FUNCTION                          ~4      [0]
   11     1        ASSIGN                                                   !0, ~4
   20     2        NEW                                              $6      'CachingIterator'
          3        INIT_DYNAMIC_CALL                                        !0
          4        DO_FCALL                                      0  $7      
          5        SEND_VAR_NO_REF_EX                                       $7
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $6
   22     8      > FE_RESET_R                                       $10     !1, ->16
          9    > > FE_FETCH_R                                       ~11     $10, !2, ->16
         10    >   ASSIGN                                                   !3, ~11
   23    11        INIT_NS_FCALL_BY_NAME                                    'App%5Cvar_dump'
         12        SEND_VAR_EX                                              !3
         13        SEND_VAR_EX                                              !2
         14        DO_FCALL                                      0          
   22    15      > JMP                                                      ->9
         16    >   FE_FREE                                                  $10
   26    17        INIT_METHOD_CALL                                         !1, 'getCache'
         18        DO_FCALL                                      0  $14     
         19      > FE_RESET_R                                       $15     $14, ->27
         20    > > FE_FETCH_R                                       ~16     $15, !2, ->27
         21    >   ASSIGN                                                   !3, ~16
   27    22        INIT_NS_FCALL_BY_NAME                                    'App%5Cvar_dump'
         23        SEND_VAR_EX                                              !3
         24        SEND_VAR_EX                                              !2
         25        DO_FCALL                                      0          
   26    26      > JMP                                                      ->20
         27    >   FE_FREE                                                  $15
   28    28      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/a0Uc7
function name:  App\{closure}
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   GENERATOR_CREATE                                         
   16     1        YIELD                                                    <true>, <true>
   17     2        YIELD                                                    <false>, <false>
   18     3      > GENERATOR_RETURN                                         

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
134.64 ms | 1441 KiB | 14 Q