3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "<pre>"; $array = array_fill(0, 10, range("A", "Z")); function getTests($array) { $it = new ArrayIterator($array); $tests = array(); foreach ( $it as $range ) { foreach ( array_chunk($range, 2) as $chunk ) { yield $chunk; } } } foreach(getTests($array) as $value) { print_r($value); } ?>

Abusive script

This script was stopped while abusing our resources

Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 20
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 20
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/nhCja
function name:  (null)
number of ops:  22
compiled vars:  !0 = $array, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ECHO                                                     '%3Cpre%3E'
    4     1        INIT_FCALL                                               'array_fill'
          2        SEND_VAL                                                 0
          3        SEND_VAL                                                 10
          4        INIT_FCALL                                               'range'
          5        SEND_VAL                                                 'A'
          6        SEND_VAL                                                 'Z'
          7        DO_ICALL                                         $2      
          8        SEND_VAR                                                 $2
          9        DO_ICALL                                         $3      
         10        ASSIGN                                                   !0, $3
   17    11        INIT_FCALL                                               'gettests'
         12        SEND_VAR                                                 !0
         13        DO_FCALL                                      0  $5      
         14      > FE_RESET_R                                       $6      $5, ->20
         15    > > FE_FETCH_R                                               $6, !1, ->20
   19    16    >   INIT_FCALL                                               'print_r'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                                 
   17    19      > JMP                                                      ->15
         20    >   FE_FREE                                                  $6
   21    21      > RETURN                                                   1

Function gettests:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 19
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 19
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 17
Branch analysis from position: 19
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 19
filename:       /in/nhCja
function name:  getTests
number of ops:  21
compiled vars:  !0 = $array, !1 = $it, !2 = $tests, !3 = $range, !4 = $chunk
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
    7     2        NEW                                              $5      'ArrayIterator'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
    9     6        ASSIGN                                                   !2, <array>
   10     7      > FE_RESET_R                                       $9      !1, ->19
          8    > > FE_FETCH_R                                               $9, !3, ->19
   11     9    >   INIT_FCALL                                               'array_chunk'
         10        SEND_VAR                                                 !3
         11        SEND_VAL                                                 2
         12        DO_ICALL                                         $10     
         13      > FE_RESET_R                                       $11     $10, ->17
         14    > > FE_FETCH_R                                               $11, !4, ->17
   12    15    >   YIELD                                                    !4
   11    16      > JMP                                                      ->14
         17    >   FE_FREE                                                  $11
   10    18      > JMP                                                      ->8
         19    >   FE_FREE                                                  $9
   15    20      > GENERATOR_RETURN                                         

End of function gettests

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.79 ms | 1012 KiB | 18 Q