3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = array(0 => 1, 2 => 3, 4 => 5, 6 => 7, 8 => 9); each($x); $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 = 25
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 9
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 45, Position 2 = 29
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
2 jumps found. (Code = 44) Position 1 = 65, Position 2 = 49
Branch analysis from position: 65
1 jumps found. (Code = 42) Position 1 = 71
Branch analysis from position: 71
2 jumps found. (Code = 44) Position 1 = 79, Position 2 = 66
Branch analysis from position: 79
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 66
2 jumps found. (Code = 44) Position 1 = 79, Position 2 = 66
Branch analysis from position: 79
Branch analysis from position: 66
Branch analysis from position: 49
2 jumps found. (Code = 43) Position 1 = 56, Position 2 = 57
Branch analysis from position: 56
1 jumps found. (Code = 42) Position 1 = 65
Branch analysis from position: 65
Branch analysis from position: 57
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 45, Position 2 = 29
Branch analysis from position: 45
Branch analysis from position: 29
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 25
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
Branch analysis from position: 25
filename:       /in/Ls7Vv
function name:  (null)
number of ops:  80
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        INIT_FCALL_BY_NAME                                       'each'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
    6     4        NEW                                              $6      'ArrayIterator'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $6
    7     8      > JMP                                                      ->25
    8     9    >   INIT_METHOD_CALL                                         !1, 'key'
         10        DO_FCALL                                      0  $9      
         11        ASSIGN                                                   !2, $9
    9    12        INIT_METHOD_CALL                                         !1, 'current'
         13        DO_FCALL                                      0  $11     
         14        ASSIGN                                                   !3, $11
   10    15        INIT_METHOD_CALL                                         !1, 'next'
         16        DO_FCALL                                      0          
   11    17        CONCAT                                           ~14     'first+loop+%28each%29%3A', !2
         18        CONCAT                                           ~15     ~14, '%3D%3E'
         19        CONCAT                                           ~16     ~15, !3
         20        CONCAT                                           ~17     ~16, '%0A'
         21        ECHO                                                     ~17
   12    22        IS_EQUAL                                                 !2, 4
         23      > JMPZ                                                     ~18, ->25
   13    24    > > JMP                                                      ->28
    7    25    >   INIT_METHOD_CALL                                         !1, 'valid'
         26        DO_FCALL                                      0  $19     
         27      > JMPNZ                                                    $19, ->9
   16    28    > > JMP                                                      ->42
   17    29    >   INIT_METHOD_CALL                                         !1, 'key'
         30        DO_FCALL                                      0  $20     
         31        ASSIGN                                                   !2, $20
   18    32        INIT_METHOD_CALL                                         !1, 'current'
         33        DO_FCALL                                      0  $22     
         34        ASSIGN                                                   !3, $22
   19    35        INIT_METHOD_CALL                                         !1, 'next'
         36        DO_FCALL                                      0          
   20    37        CONCAT                                           ~25     'second+loop+%28each%29%3A', !2
         38        CONCAT                                           ~26     ~25, '%3D%3E'
         39        CONCAT                                           ~27     ~26, !3
         40        CONCAT                                           ~28     ~27, '%0A'
         41        ECHO                                                     ~28
   16    42    >   INIT_METHOD_CALL                                         !1, 'valid'
         43        DO_FCALL                                      0  $29     
         44      > JMPNZ                                                    $29, ->29
   23    45    >   INIT_FCALL                                               'reset'
         46        SEND_REF                                                 !0
         47        DO_ICALL                                                 
   24    48      > JMP                                                      ->57
   25    49    >   CONCAT                                           ~31     'first+loop+%28each%29%3A', !2
         50        CONCAT                                           ~32     ~31, '%3D%3E'
         51        CONCAT                                           ~33     ~32, !3
         52        CONCAT                                           ~34     ~33, '%0A'
         53        ECHO                                                     ~34
   26    54        IS_EQUAL                                                 !2, 4
         55      > JMPZ                                                     ~35, ->57
   27    56    > > JMP                                                      ->65
   24    57    >   INIT_FCALL_BY_NAME                                       'each'
         58        SEND_VAR_EX                                              !0
         59        DO_FCALL                                      0  $36     
         60        FETCH_LIST_R                                     $37     $36, 0
         61        ASSIGN                                                   !2, $37
         62        FETCH_LIST_R                                     $39     $36, 1
         63        ASSIGN                                                   !3, $39
         64      > JMPNZ                                                    $36, ->49
   30    65    > > JMP                                                      ->71
   31    66    >   CONCAT                                           ~41     'second+loop+%28each%29%3A', !2
         67        CONCAT                                           ~42     ~41, '%3D%3E'
         68        CONCAT                                           ~43     ~42, !3
         69        CONCAT                                           ~44     ~43, '%0A'
         70        ECHO                                                     ~44
   30    71    >   INIT_FCALL_BY_NAME                                       'each'
         72        SEND_VAR_EX                                              !0
         73        DO_FCALL                                      0  $45     
         74        FETCH_LIST_R                                     $46     $45, 0
         75        ASSIGN                                                   !2, $46
         76        FETCH_LIST_R                                     $48     $45, 1
         77        ASSIGN                                                   !3, $48
         78      > JMPNZ                                                    $45, ->66
   32    79    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
189.62 ms | 1408 KiB | 15 Q