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' ); // use($searchBy) function find($a) { global $searchBy ; return array_intersect_assoc($searchBy, $a) == $searchBy; } $find = array_filter($array, "find"); print_r($find); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Gs7Bm
function name:  (null)
number of ops:  11
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>
   29     2        INIT_FCALL                                               'array_filter'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'find'
          5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !2, $5
   31     7        INIT_FCALL                                               'print_r'
          8        SEND_VAR                                                 !2
          9        DO_ICALL                                                 
   33    10      > RETURN                                                   1

Function find:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Gs7Bm
function name:  find
number of ops:  9
compiled vars:  !0 = $a, !1 = $searchBy
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
   26     1        BIND_GLOBAL                                              !1, 'searchBy'
   27     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
   28     8*     > RETURN                                                   null

End of function find

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.82 ms | 1395 KiB | 19 Q