3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( 'index1' => 'Deleted', 'index2' => 'numbers', 'index3' => 'test', 'index4' => 'Inserted', ); $i=0; $specificIndex = array('index3','index2') ; $array1=array(); foreach($array as $key => $value){ if($key==$specificIndex[$i]){ $array1[$key] = $value; unset($array[$specificIndex[$i]]); $i++; } } print_r($specificIndex); print_r($array); print_r($array1);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 16
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 16
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
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/SW2MW
function name:  (null)
number of ops:  27
compiled vars:  !0 = $array, !1 = $i, !2 = $specificIndex, !3 = $array1, !4 = $value, !5 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    8     1        ASSIGN                                                   !1, 0
    9     2        ASSIGN                                                   !2, <array>
   10     3        ASSIGN                                                   !3, <array>
   11     4      > FE_RESET_R                                       $10     !0, ->16
          5    > > FE_FETCH_R                                       ~11     $10, !4, ->16
          6    >   ASSIGN                                                   !5, ~11
   12     7        FETCH_DIM_R                                      ~13     !2, !1
          8        IS_EQUAL                                                 !5, ~13
          9      > JMPZ                                                     ~14, ->15
   13    10    >   ASSIGN_DIM                                               !3, !5
         11        OP_DATA                                                  !4
   14    12        FETCH_DIM_R                                      ~16     !2, !1
         13        UNSET_DIM                                                !0, ~16
   15    14        PRE_INC                                                  !1
   11    15    > > JMP                                                      ->5
         16    >   FE_FREE                                                  $10
   18    17        INIT_FCALL                                               'print_r'
         18        SEND_VAR                                                 !2
         19        DO_ICALL                                                 
   19    20        INIT_FCALL                                               'print_r'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                                 
   20    23        INIT_FCALL                                               'print_r'
         24        SEND_VAR                                                 !3
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.13 ms | 1396 KiB | 15 Q