3v4l.org

run code in 300+ PHP versions simultaneously
<?php $exclusions = [ 'Discontinue Status' => [ 'Discontinued', 'Run Down Stock', ], 'Hazardous' => [ 'No', ], ]; $products = [ [ 'Product ID' => '452', 'Discontinue Status' => 'Discontinued', 'Hazardous' => 'No', ], [ 'Product ID' => '463', 'Discontinue Status' => 'Normal', 'Hazardous' => 'No', ], [ 'Product ID' => '477', 'Discontinue Status' => 'Run Down Stock', 'Hazardous' => 'Yes', ], [ 'Product ID' => '502', 'Discontinue Status' => 'Discontinued', 'Hazardous' => 'No', ], [ 'Product ID' => '520', 'Discontinue Status' => 'Normal', 'Hazardous' => 'Yes', ], ]; foreach ($products as $index => $product) { foreach (array_intersect_key($product, $exclusions) as $key => $value) { if (in_array($value, $exclusions[$key])) { unset($products[$index]); break; } } } var_export(array_values($products));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 23
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 23
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 21
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 21
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 21
Branch analysis from position: 21
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/pqgmR
function name:  (null)
number of ops:  31
compiled vars:  !0 = $exclusions, !1 = $products, !2 = $product, !3 = $index, !4 = $value, !5 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   13     1        ASSIGN                                                   !1, <array>
   41     2      > FE_RESET_R                                       $8      !1, ->23
          3    > > FE_FETCH_R                                       ~9      $8, !2, ->23
          4    >   ASSIGN                                                   !3, ~9
   42     5        INIT_FCALL                                               'array_intersect_key'
          6        SEND_VAR                                                 !2
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $11     
          9      > FE_RESET_R                                       $12     $11, ->21
         10    > > FE_FETCH_R                                       ~13     $12, !4, ->21
         11    >   ASSIGN                                                   !5, ~13
   43    12        INIT_FCALL                                               'in_array'
         13        SEND_VAR                                                 !4
         14        FETCH_DIM_R                                      ~15     !0, !5
         15        SEND_VAL                                                 ~15
         16        DO_ICALL                                         $16     
         17      > JMPZ                                                     $16, ->20
   44    18    >   UNSET_DIM                                                !1, !3
   45    19      > JMP                                                      ->21
   42    20    > > JMP                                                      ->10
         21    >   FE_FREE                                                  $12
   41    22      > JMP                                                      ->3
         23    >   FE_FREE                                                  $8
   49    24        INIT_FCALL                                               'var_export'
         25        INIT_FCALL                                               'array_values'
         26        SEND_VAR                                                 !1
         27        DO_ICALL                                         $17     
         28        SEND_VAR                                                 $17
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.8 ms | 1396 KiB | 21 Q