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', ], ]; var_export( array_values( array_filter( $products, function($product) use ($exclusions) { return !array_filter( array_intersect_key($product, $exclusions), function($value, $key) use ($exclusions) { return in_array($value, $exclusions[$key]); }, ARRAY_FILTER_USE_BOTH ); } ) ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p4Htl
function name:  (null)
number of ops:  15
compiled vars:  !0 = $exclusions, !1 = $products
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   13     1        ASSIGN                                                   !1, <array>
   41     2        INIT_FCALL                                               'var_export'
   42     3        INIT_FCALL                                               'array_values'
   43     4        INIT_FCALL                                               'array_filter'
   44     5        SEND_VAR                                                 !1
   45     6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fp4Htl%3A45%240'
          7        BIND_LEXICAL                                             ~4, !0
   53     8        SEND_VAL                                                 ~4
          9        DO_ICALL                                         $5      
         10        SEND_VAR                                                 $5
         11        DO_ICALL                                         $6      
         12        SEND_VAR                                                 $6
         13        DO_ICALL                                                 
   56    14      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fp4Htl%3A45%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p4Htl
function name:  {closure}
number of ops:  16
compiled vars:  !0 = $product, !1 = $exclusions
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   45     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   46     2        INIT_FCALL                                               'array_filter'
   47     3        INIT_FCALL                                               'array_intersect_key'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $2      
          7        SEND_VAR                                                 $2
   48     8        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fp4Htl%3A48%241'
          9        BIND_LEXICAL                                             ~3, !1
   50    10        SEND_VAL                                                 ~3
   51    11        SEND_VAL                                                 1
         12        DO_ICALL                                         $4      
         13        BOOL_NOT                                         ~5      $4
         14      > RETURN                                                   ~5
   53    15*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fp4Htl%3A45%240

Function %00%7Bclosure%7D%2Fin%2Fp4Htl%3A48%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p4Htl
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $value, !1 = $key, !2 = $exclusions
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   48     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   49     3        INIT_FCALL                                               'in_array'
          4        SEND_VAR                                                 !0
          5        FETCH_DIM_R                                      ~3      !2, !1
          6        SEND_VAL                                                 ~3
          7        DO_ICALL                                         $4      
          8      > RETURN                                                   $4
   50     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fp4Htl%3A48%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.62 ms | 1404 KiB | 23 Q