3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( array( 'Field1' => 'red', 'Field2' => 'green', 'Field3' => 'blue' ), array( 'Field1' => 'pink', 'Field2' => 'pinkish', 'Field3' => 'barbiecolor' ), array( 'Field1' => 'red', 'Field2' => 'blue', ' Field3' => 'orange' ) ); $searchBy = array( 'Field1' => 'red', 'Field2' => 'blue' ); $find = array_filter($array, function ($a) use($searchBy) { return array_intersect_assoc($searchBy, $a) == $searchBy; }); print_r($find); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KFs7E
function name:  (null)
number of ops:  13
compiled vars:  !0 = $array, !1 = $searchBy, !2 = $find
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   19     1        ASSIGN                                                   !1, <array>
   24     2        INIT_FCALL                                               'array_filter'
          3        SEND_VAR                                                 !0
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FKFs7E%3A24%240'
          5        BIND_LEXICAL                                             ~5, !1
   26     6        SEND_VAL                                                 ~5
          7        DO_ICALL                                         $6      
   24     8        ASSIGN                                                   !2, $6
   29     9        INIT_FCALL                                               'print_r'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                                 
   31    12      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FKFs7E%3A24%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KFs7E
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $a, !1 = $searchBy
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   25     2        INIT_FCALL                                               'array_intersect_assoc'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        IS_EQUAL                                         ~3      !1, $2
          7      > RETURN                                                   ~3
   26     8*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FKFs7E%3A24%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.67 ms | 1395 KiB | 19 Q