3v4l.org

run code in 300+ PHP versions simultaneously
<?php $table = array( array( "name" => "1", "age" => 10, "answer" => "One" ), array( "name" => "2", "age" => 20, "answer" => "Two" ) ); $input = array( "name" => "2", "age" => 20 ); $isEntryMatches = array_reduce($table, function($result, $entry) use ($input) { $isValuesMatches = array_reduce($entry, function($result, $value) use ($input) { return $result && $value[key($value)] == $input[key($value)]; }, true); }, true); print $isEntryMatches;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jT6o9
function name:  (null)
number of ops:  12
compiled vars:  !0 = $table, !1 = $input, !2 = $isEntryMatches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   16     1        ASSIGN                                                   !1, <array>
   21     2        INIT_FCALL                                               'array_reduce'
          3        SEND_VAR                                                 !0
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FjT6o9%3A21%240'
          5        BIND_LEXICAL                                             ~5, !1
   25     6        SEND_VAL                                                 ~5
          7        SEND_VAL                                                 <true>
          8        DO_ICALL                                         $6      
   21     9        ASSIGN                                                   !2, $6
   27    10        ECHO                                                     !2
         11      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FjT6o9%3A21%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jT6o9
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $result, !1 = $entry, !2 = $input, !3 = $isValuesMatches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   22     3        INIT_FCALL                                               'array_reduce'
          4        SEND_VAR                                                 !1
          5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FjT6o9%3A22%241'
          6        BIND_LEXICAL                                             ~4, !2
   24     7        SEND_VAL                                                 ~4
          8        SEND_VAL                                                 <true>
          9        DO_ICALL                                         $5      
   22    10        ASSIGN                                                   !3, $5
   25    11      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FjT6o9%3A21%240

Function %00%7Bclosure%7D%2Fin%2FjT6o9%3A22%241:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/jT6o9
function name:  {closure}
number of ops:  16
compiled vars:  !0 = $result, !1 = $value, !2 = $input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   23     3      > JMPZ_EX                                          ~3      !0, ->14
          4    >   INIT_FCALL                                               'key'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $4      
          7        FETCH_DIM_R                                      ~5      !1, $4
          8        INIT_FCALL                                               'key'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $6      
         11        FETCH_DIM_R                                      ~7      !2, $6
         12        IS_EQUAL                                         ~8      ~5, ~7
         13        BOOL                                             ~3      ~8
         14    > > RETURN                                                   ~3
   24    15*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FjT6o9%3A22%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.43 ms | 1400 KiB | 17 Q