3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); namespace App; use Generator; use CachingIterator; class Foo {} $generator = /** * @return Generator<bool, bool> */ static function (): Generator { yield true => true; yield false => false; yield "foo" => new Foo(); yield "bar" => new Foo(); yield "baz" => new Foo(); }; $iterator = new CachingIterator($generator(), CachingIterator::FULL_CACHE | CachingIterator::CALL_TOSTRING); 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/0LIrS
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
-------------------------------------------------------------------------------------
   16     0  E >   DECLARE_LAMBDA_FUNCTION                          ~4      [0]
   12     1        ASSIGN                                                   !0, ~4
   24     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                                              257
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !1, $6
   26     9      > FE_RESET_R                                       $10     !1, ->17
         10    > > FE_FETCH_R                                       ~11     $10, !2, ->17
         11    >   ASSIGN                                                   !3, ~11
   27    12        INIT_NS_FCALL_BY_NAME                                    'App%5Cvar_dump'
         13        SEND_VAR_EX                                              !3
         14        SEND_VAR_EX                                              !2
         15        DO_FCALL                                      0          
   26    16      > JMP                                                      ->10
         17    >   FE_FREE                                                  $10
   30    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
   31    23        INIT_NS_FCALL_BY_NAME                                    'App%5Cvar_dump'
         24        SEND_VAR_EX                                              !3
         25        SEND_VAR_EX                                              !2
         26        DO_FCALL                                      0          
   30    27      > JMP                                                      ->21
         28    >   FE_FREE                                                  $15
   32    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/0LIrS
function name:  App\{closure}
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   GENERATOR_CREATE                                         
   17     1        YIELD                                                    <true>, <true>
   18     2        YIELD                                                    <false>, <false>
   19     3        NEW                                              $2      'App%5CFoo'
          4        DO_FCALL                                      0          
          5        YIELD                                                    $2, 'foo'
   20     6        NEW                                              $5      'App%5CFoo'
          7        DO_FCALL                                      0          
          8        YIELD                                                    $5, 'bar'
   21     9        NEW                                              $8      'App%5CFoo'
         10        DO_FCALL                                      0          
         11        YIELD                                                    $8, 'baz'
   22    12      > GENERATOR_RETURN                                         

End of Dynamic Function 0

Class App\Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.11 ms | 989 KiB | 14 Q