3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arr = [0,0,23,0,0,18,0,0]; $counter = 1; foreach ($arr as &$val){ if($val !== 0){ $val = $counter++; } } print_r($arr);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
2 jumps found. (Code = 126) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 8
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/VVkNZ
function name:  (null)
number of ops:  14
compiled vars:  !0 = $arr, !1 = $counter, !2 = $val
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    4     1        ASSIGN                                                       !1, 1
    5     2      > FE_RESET_RW                                          $5      !0, ->9
          3    > > FE_FETCH_RW                                                  $5, !2, ->9
    6     4    >   IS_NOT_IDENTICAL                                             !2, 0
          5      > JMPZ                                                         ~6, ->8
    7     6    >   POST_INC                                             ~7      !1
          7        ASSIGN                                                       !2, ~7
    5     8    > > JMP                                                          ->3
          9    >   FE_FREE                                                      $5
   10    10        INIT_FCALL                                                   'print_r'
         11        SEND_VAR                                                     !0
         12        DO_ICALL                                                     
         13      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
165.83 ms | 2229 KiB | 14 Q