3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array( 'a' => array( 'name' => 'a1', 'second_name' => 'a2' ), 'b' => array( 'name' => 'b1', 'second_name' => 'b2' ), 'c' => array( 'name' => 'c1', 'second_name' => 'c2' ) ); $field = 'name'; $search = 'b2'; print_r( array_filter( $a, function($value, $field, $search){ print_r($value); return $value[$field] == $search; } ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BCoVZ
function name:  (null)
number of ops:  12
compiled vars:  !0 = $a, !1 = $field, !2 = $search
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   18     1        ASSIGN                                                   !1, 'name'
   19     2        ASSIGN                                                   !2, 'b2'
   21     3        INIT_FCALL                                               'print_r'
   22     4        INIT_FCALL                                               'array_filter'
   23     5        SEND_VAR                                                 !0
   24     6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FBCoVZ%3A24%240'
   27     7        SEND_VAL                                                 ~6
          8        DO_ICALL                                         $7      
          9        SEND_VAR                                                 $7
         10        DO_ICALL                                                 
   29    11      > RETURN                                                   1

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

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.57 ms | 1395 KiB | 17 Q