3v4l.org

run code in 500+ PHP versions simultaneously
<?php $x = array(0 => 1, 2 => 3, 4 => 5, 6 => 7, 8 => 9); $it = new ArrayIterator($x); while ($it->valid()) { $key = $it->key(); $value = $it->current(); $it->next(); echo "first loop (each):" . $key . "=>" . $value . "\n"; if ($key == 4) { break; } } while ($it->valid()) { $key = $it->key(); $value = $it->current(); $it->next(); echo "second loop (each):" . $key . "=>" . $value . "\n"; } reset($x); while (list($key, $value) = each($x)) { echo "first loop (each):" . $key . "=>" . $value . "\n"; if ($key == 4) { break; } } while (list($key, $value) = each($x)) { echo "second loop (each):" . $key . "=>" . $value . "\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 6
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 26
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 46
Branch analysis from position: 62
1 jumps found. (Code = 42) Position 1 = 68
Branch analysis from position: 68
2 jumps found. (Code = 44) Position 1 = 76, Position 2 = 63
Branch analysis from position: 76
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 63
2 jumps found. (Code = 44) Position 1 = 76, Position 2 = 63
Branch analysis from position: 76
Branch analysis from position: 63
Branch analysis from position: 46
2 jumps found. (Code = 43) Position 1 = 53, Position 2 = 54
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 62
Branch analysis from position: 62
Branch analysis from position: 54
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 26
Branch analysis from position: 42
Branch analysis from position: 26
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 22
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 22
filename:       /in/aj5JZ
function name:  (null)
number of ops:  77
compiled vars:  !0 = $x, !1 = $it, !2 = $key, !3 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    5     1        NEW                                                  $5      'ArrayIterator'
          2        SEND_VAR_EX                                                  !0
          3        DO_FCALL                                          0          
          4        ASSIGN                                                       !1, $5
    6     5      > JMP                                                          ->22
    7     6    >   INIT_METHOD_CALL                                             !1, 'key'
          7        DO_FCALL                                          0  $8      
          8        ASSIGN                                                       !2, $8
    8     9        INIT_METHOD_CALL                                             !1, 'current'
         10        DO_FCALL                                          0  $10     
         11        ASSIGN                                                       !3, $10
    9    12        INIT_METHOD_CALL                                             !1, 'next'
         13        DO_FCALL                                          0          
   10    14        CONCAT                                               ~13     'first+loop+%28each%29%3A', !2
         15        CONCAT                                               ~14     ~13, '%3D%3E'
         16        CONCAT                                               ~15     ~14, !3
         17        CONCAT                                               ~16     ~15, '%0A'
         18        ECHO                                                         ~16
   11    19        IS_EQUAL                                                     !2, 4
         20      > JMPZ                                                         ~17, ->22
   12    21    > > JMP                                                          ->25
    6    22    >   INIT_METHOD_CALL                                             !1, 'valid'
         23        DO_FCALL                                          0  $18     
         24      > JMPNZ                                                        $18, ->6
   15    25    > > JMP                                                          ->39
   16    26    >   INIT_METHOD_CALL                                             !1, 'key'
         27        DO_FCALL                                          0  $19     
         28        ASSIGN                                                       !2, $19
   17    29        INIT_METHOD_CALL                                             !1, 'current'
         30        DO_FCALL                                          0  $21     
         31        ASSIGN                                                       !3, $21
   18    32        INIT_METHOD_CALL                                             !1, 'next'
         33        DO_FCALL                                          0          
   19    34        CONCAT                                               ~24     'second+loop+%28each%29%3A', !2
         35        CONCAT                                               ~25     ~24, '%3D%3E'
         36        CONCAT                                               ~26     ~25, !3
         37        CONCAT                                               ~27     ~26, '%0A'
         38        ECHO                                                         ~27
   15    39    >   INIT_METHOD_CALL                                             !1, 'valid'
         40        DO_FCALL                                          0  $28     
         41      > JMPNZ                                                        $28, ->26
   22    42    >   INIT_FCALL                                                   'reset'
         43        SEND_REF                                                     !0
         44        DO_ICALL                                                     
   23    45      > JMP                                                          ->54
   24    46    >   CONCAT                                               ~30     'first+loop+%28each%29%3A', !2
         47        CONCAT                                               ~31     ~30, '%3D%3E'
         48        CONCAT                                               ~32     ~31, !3
         49        CONCAT                                               ~33     ~32, '%0A'
         50        ECHO                                                         ~33
   25    51        IS_EQUAL                                                     !2, 4
         52      > JMPZ                                                         ~34, ->54
   26    53    > > JMP                                                          ->62
   23    54    >   INIT_FCALL_BY_NAME                                           'each'
         55        SEND_VAR_EX                                                  !0
         56        DO_FCALL                                          0  $35     
         57        FETCH_LIST_R                                         $36     $35, 0
         58        ASSIGN                                                       !2, $36
         59        FETCH_LIST_R                                         $38     $35, 1
         60        ASSIGN                                                       !3, $38
         61      > JMPNZ                                                        $35, ->46
   29    62    > > JMP                                                          ->68
   30    63    >   CONCAT                                               ~40     'second+loop+%28each%29%3A', !2
         64        CONCAT                                               ~41     ~40, '%3D%3E'
         65        CONCAT                                               ~42     ~41, !3
         66        CONCAT                                               ~43     ~42, '%0A'
         67        ECHO                                                         ~43
   29    68    >   INIT_FCALL_BY_NAME                                           'each'
         69        SEND_VAR_EX                                                  !0
         70        DO_FCALL                                          0  $44     
         71        FETCH_LIST_R                                         $45     $44, 0
         72        ASSIGN                                                       !2, $45
         73        FETCH_LIST_R                                         $47     $44, 1
         74        ASSIGN                                                       !3, $47
         75      > JMPNZ                                                        $44, ->63
   31    76    > > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
174.84 ms | 2655 KiB | 14 Q