3v4l.org

run code in 500+ PHP versions simultaneously
<?php $a = array("test"=>"1", "test2"=>2, "test3"=>3); $needed = array("test", "test2"); foreach($a as $i => $v) { if(!in_array($i, $needed)) { unset($a[$i]); } } print_r($a);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/aMWS4
function name:  (null)
number of ops:  15
compiled vars:  !0 = $a, !1 = $needed, !2 = $v, !3 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    4     1        ASSIGN                                                       !1, <array>
    5     2      > FE_RESET_R                                           $6      !0, ->10
          3    > > FE_FETCH_R                                           ~7      $6, !2, ->10
          4    >   ASSIGN                                                       !3, ~7
    6     5        FRAMELESS_ICALL_2                in_array            ~9      !3, !1
          6        BOOL_NOT                                             ~10     ~9
          7      > JMPZ                                                         ~10, ->9
    7     8    >   UNSET_DIM                                                    !0, !3
    5     9    > > JMP                                                          ->3
         10    >   FE_FREE                                                      $6
   11    11        INIT_FCALL                                                   'print_r'
         12        SEND_VAR                                                     !0
         13        DO_ICALL                                                     
         14      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.39 ms | 2746 KiB | 16 Q