3v4l.org

run code in 500+ PHP versions simultaneously
<?php $input = array( array(1,2,3), array(4,5,3), array(7,8,4), array(9,10,4), array(11,12,4) ); $out1 = $out2 = []; $splitIndex = 2; foreach($input as $k => $v){ if($k < $splitIndex){ $out1[] = $v; }else{ $out2[] = $v; } } print_r($out1); print_r($out2);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 15
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 15
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/pUTjo
function name:  (null)
number of ops:  23
compiled vars:  !0 = $input, !1 = $out1, !2 = $out2, !3 = $splitIndex, !4 = $v, !5 = $k
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   10     1        ASSIGN                                               ~7      !2, <array>
          2        ASSIGN                                                       !1, ~7
   11     3        ASSIGN                                                       !3, 2
   12     4      > FE_RESET_R                                           $10     !0, ->15
          5    > > FE_FETCH_R                                           ~11     $10, !4, ->15
          6    >   ASSIGN                                                       !5, ~11
   13     7        IS_SMALLER                                                   !5, !3
          8      > JMPZ                                                         ~13, ->12
   14     9    >   ASSIGN_DIM                                                   !1
         10        OP_DATA                                                      !4
   13    11      > JMP                                                          ->14
   16    12    >   ASSIGN_DIM                                                   !2
         13        OP_DATA                                                      !4
   12    14    > > JMP                                                          ->5
         15    >   FE_FREE                                                      $10
   19    16        INIT_FCALL                                                   'print_r'
         17        SEND_VAR                                                     !1
         18        DO_ICALL                                                     
   20    19        INIT_FCALL                                                   'print_r'
         20        SEND_VAR                                                     !2
         21        DO_ICALL                                                     
         22      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.96 ms | 2183 KiB | 14 Q