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, fn($product) => !array_filter( array_intersect_key($product, $exclusions), fn($value, $key) => 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/GRpdD
function name:  (null)
number of ops:  17
compiled vars:  !0 = $exclusions, !1 = $products, !2 = $value, !3 = $key
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%2FGRpdD%3A45%240'
          7        BIND_LEXICAL                                             ~6, !0
          8        BIND_LEXICAL                                             ~6, !2
          9        BIND_LEXICAL                                             ~6, !3
   50    10        SEND_VAL                                                 ~6
         11        DO_ICALL                                         $7      
         12        SEND_VAR                                                 $7
         13        DO_ICALL                                         $8      
         14        SEND_VAR                                                 $8
         15        DO_ICALL                                                 
   52    16      > RETURN                                                   1

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

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

Function %00%7Bclosure%7D%2Fin%2FGRpdD%3A47%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GRpdD
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $value, !1 = $key, !2 = $exclusions
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   47     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          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
          9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FGRpdD%3A47%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.01 ms | 945 KiB | 24 Q