3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ids_arr = [213, 154]; $fruits_arr = [ ["id" => 213, "fruit" => "banana"], ["id" => 438, "fruit" => "apple"], ["id" => 154, "fruit" => "peach"] ]; $ids_arr = array_flip($ids_arr); $selected_fruits = []; foreach ($fruits_arr as $k => $fruit) { if (isset($ids_arr[$fruit["id"]])) { $selected_fruits[$k] = $fruit; } } print_r($selected_fruits);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 16
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
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/8dNZp
function name:  (null)
number of ops:  21
compiled vars:  !0 = $ids_arr, !1 = $fruits_arr, !2 = $selected_fruits, !3 = $fruit, !4 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
   10     2        INIT_FCALL                                               'array_flip'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $7      
          5        ASSIGN                                                   !0, $7
   11     6        ASSIGN                                                   !2, <array>
   13     7      > FE_RESET_R                                       $10     !1, ->16
          8    > > FE_FETCH_R                                       ~11     $10, !3, ->16
          9    >   ASSIGN                                                   !4, ~11
   14    10        FETCH_DIM_R                                      ~13     !3, 'id'
         11        ISSET_ISEMPTY_DIM_OBJ                         0          !0, ~13
         12      > JMPZ                                                     ~14, ->15
   15    13    >   ASSIGN_DIM                                               !2, !4
         14        OP_DATA                                                  !3
   13    15    > > JMP                                                      ->8
         16    >   FE_FREE                                                  $10
   18    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:
158.9 ms | 1011 KiB | 15 Q