3v4l.org

run code in 300+ PHP versions simultaneously
<?php $keys = ["1","2","3","4-1","99","1","2","3","4-1","4-2","4-3","99","1","2","3","4-1","4-2","99"]; $values = ["a","b","c","d","x","a1","b1","c1","d1","e","g","x","a2","b2","c2","d2","e","x"]; $new_array = array(); $split_at = "99"; $i = 0; foreach ($keys as $key => $value) { $new_array[$i][$value] =$values[$key]; if($split_at == $value){ $i++; } } print_r($new_array);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 16
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 16
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 15
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/uAsjN
function name:  (null)
number of ops:  21
compiled vars:  !0 = $keys, !1 = $values, !2 = $new_array, !3 = $split_at, !4 = $i, !5 = $value, !6 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    5     2        ASSIGN                                                   !2, <array>
    6     3        ASSIGN                                                   !3, '99'
    7     4        ASSIGN                                                   !4, 0
    8     5      > FE_RESET_R                                       $12     !0, ->16
          6    > > FE_FETCH_R                                       ~13     $12, !5, ->16
          7    >   ASSIGN                                                   !6, ~13
    9     8        FETCH_DIM_R                                      ~17     !1, !6
          9        FETCH_DIM_W                                      $15     !2, !4
         10        ASSIGN_DIM                                               $15, !5
         11        OP_DATA                                                  ~17
   11    12        IS_EQUAL                                                 !3, !5
         13      > JMPZ                                                     ~18, ->15
   12    14    >   PRE_INC                                                  !4
    8    15    > > JMP                                                      ->6
         16    >   FE_FREE                                                  $12
   16    17        INIT_FCALL                                               'print_r'
         18        SEND_VAR                                                 !2
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.73 ms | 1395 KiB | 15 Q