3v4l.org

run code in 500+ PHP versions simultaneously
<?php $a = array( array( "id" => "1", "values" => array( "1", "2" ) ), array( "id" => "2", "values" => array( "1", "3" ) ), array( "id" => "3", "values" => array( "2", "4" ) ), array( "id" => "4", "values" => array( "4", "6" ) ), ); $value = '2'; $result = array_filter($a, function (array $element) use ($value) { return array_key_exists('values', $element) && is_array($element['values']) && in_array($value, $element['values'], true); }); var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4HnFV
function name:  (null)
number of ops:  13
compiled vars:  !0 = $a, !1 = $value, !2 = $result
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   34     1        ASSIGN                                                       !1, '2'
   36     2        INIT_FCALL                                                   'array_filter'
          3        SEND_VAR                                                     !0
          4        DECLARE_LAMBDA_FUNCTION                              ~5      [0]
          5        BIND_LEXICAL                                                 ~5, !1
   38     6        SEND_VAL                                                     ~5
   36     7        DO_ICALL                                             $6      
          8        ASSIGN                                                       !2, $6
   40     9        INIT_FCALL                                                   'var_dump'
         10        SEND_VAR                                                     !2
         11        DO_ICALL                                                     
         12      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
2 jumps found. (Code = 46) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
Branch analysis from position: 7
filename:       /in/4HnFV
function name:  {closure:/in/4HnFV:36}
number of ops:  14
compiled vars:  !0 = $element, !1 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   36     0  E >   RECV                                                 !0      
          1        BIND_STATIC                                                  !1
   37     2        ARRAY_KEY_EXISTS                                     ~2      'values', !0
          3      > JMPZ_EX                                              ~2      ~2, ->7
          4    >   FETCH_DIM_R                                          ~3      !0, 'values'
          5        TYPE_CHECK                                      128  ~4      ~3
          6        BOOL                                                 ~2      ~4
          7    > > JMPZ_EX                                              ~2      ~2, ->12
          8    >   FETCH_DIM_R                                          ~5      !0, 'values'
          9        FRAMELESS_ICALL_3                in_array            ~6      !1, ~5
         10        OP_DATA                                                      <true>
         11        BOOL                                                 ~2      ~6
         12    > > RETURN                                                       ~2
   38    13*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
172.64 ms | 3430 KiB | 15 Q