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(), CachingIterator::FULL_CACHE); 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 = 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
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 28
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 28
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
Branch analysis from position: 17
filename:       /in/i5faS
function name:  (null)
number of ops:  30
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        SEND_VAL_EX                                              256
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !1, $6
   22     9      > FE_RESET_R                                       $10     !1, ->17
         10    > > FE_FETCH_R                                       ~11     $10, !2, ->17
         11    >   ASSIGN                                                   !3, ~11
   23    12        INIT_NS_FCALL_BY_NAME                                    'App%5Cvar_dump'
         13        SEND_VAR_EX                                              !3
         14        SEND_VAR_EX                                              !2
         15        DO_FCALL                                      0          
   22    16      > JMP                                                      ->10
         17    >   FE_FREE                                                  $10
   26    18        INIT_METHOD_CALL                                         !1, 'getCache'
         19        DO_FCALL                                      0  $14     
         20      > FE_RESET_R                                       $15     $14, ->28
         21    > > FE_FETCH_R                                       ~16     $15, !2, ->28
         22    >   ASSIGN                                                   !3, ~16
   27    23        INIT_NS_FCALL_BY_NAME                                    'App%5Cvar_dump'
         24        SEND_VAR_EX                                              !3
         25        SEND_VAR_EX                                              !2
         26        DO_FCALL                                      0          
   26    27      > JMP                                                      ->21
         28    >   FE_FREE                                                  $15
   28    29      > 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/i5faS
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:
195.94 ms | 1010 KiB | 14 Q