3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.36 ms | 1395 KiB | 17 Q