3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ "one" => 1, "two" => 2, "three" => 3, "four" => 4 ]; while (($key = key($array)) !== null) { // check if the internal pointer points beyond the end of the elements list or the array is empty echo "$key => {$array[$key]}\n"; // display current key value pair if ($array[$key] < 3) { // an arbitrary condition echo "\t"; ++$array[$key]; // increment the current value } else { // current value is satisfactory echo "\t(advance pointer)\n"; next($array); // move pointer } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 15
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 2
Branch analysis from position: 25
Branch analysis from position: 2
filename:       /in/Kr2J4
function name:  (null)
number of ops:  26
compiled vars:  !0 = $array, !1 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    9     1      > JMP                                                      ->19
   10     2    >   ROPE_INIT                                     4  ~5      !1
          3        ROPE_ADD                                      1  ~5      ~5, '+%3D%3E+'
          4        FETCH_DIM_R                                      ~3      !0, !1
          5        ROPE_ADD                                      2  ~5      ~5, ~3
          6        ROPE_END                                      3  ~4      ~5, '%0A'
          7        ECHO                                                     ~4
   11     8        FETCH_DIM_R                                      ~7      !0, !1
          9        IS_SMALLER                                               ~7, 3
         10      > JMPZ                                                     ~8, ->15
   12    11    >   ECHO                                                     '%09'
   13    12        FETCH_DIM_RW                                     $9      !0, !1
         13        PRE_INC                                                  $9
   11    14      > JMP                                                      ->19
   15    15    >   ECHO                                                     '%09%28advance+pointer%29%0A'
   16    16        INIT_FCALL                                               'next'
         17        SEND_REF                                                 !0
         18        DO_ICALL                                                 
    9    19    >   INIT_FCALL                                               'key'
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                         $12     
         22        ASSIGN                                           ~13     !1, $12
         23        TYPE_CHECK                                  1020          ~13
         24      > JMPNZ                                                    ~14, ->2
   18    25    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.15 ms | 1012 KiB | 15 Q