3v4l.org

run code in 300+ PHP versions simultaneously
<?php $itemx= [ 'Weapons'=>[ 'Sword'=> [ 'ID' => '1', 'Name' => 'Lurker', 'Value' => '12', 'Made' => 'Acient' ], 'Shield'=> [ 'ID' => '2', 'Name' => 'Obi', 'Value' => '22', 'Made' => 'Acient' ], 'Warhammer'=> [ 'ID' => '3', 'Name' => 'Clotch', 'Value' => '124', 'Made' => 'Acient' ] ], 'Drinks'=>[ 'Water'=> [ 'ID' => '4', 'Name' => 'Clean-water', 'Value' => '1', 'Made' => 'Acient' ], 'Wine'=> [ 'ID' => '5', 'Name' => 'Soff', 'Value' => '5', 'Made' => 'Acient' ], 'Vodka'=> [ 'ID' => '6', 'Name' => 'Laudur', 'Value' => '7', 'Made' => 'Acient' ] ] ]; $cat = 'Drinks'; $id = 4; $key = array_find_key( $itemx[$cat], fn($row) => $row['ID'] == $id ); var_export([$key => $itemx[$cat][$key]]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/S1WPJ
function name:  (null)
number of ops:  19
compiled vars:  !0 = $itemx, !1 = $cat, !2 = $id, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   51     1        ASSIGN                                                   !1, 'Drinks'
   52     2        ASSIGN                                                   !2, 4
   53     3        INIT_FCALL_BY_NAME                                       'array_find_key'
          4        CHECK_FUNC_ARG                                           
   54     5        FETCH_DIM_FUNC_ARG                               $7      !0, !1
          6        SEND_FUNC_ARG                                            $7
   55     7        DECLARE_LAMBDA_FUNCTION                          ~8      [0]
          8        BIND_LEXICAL                                             ~8, !2
   56     9        SEND_VAL_EX                                              ~8
   53    10        DO_FCALL                                      0  $9      
         11        ASSIGN                                                   !3, $9
   57    12        INIT_FCALL                                               'var_export'
         13        FETCH_DIM_R                                      ~11     !0, !1
         14        FETCH_DIM_R                                      ~12     ~11, !3
         15        INIT_ARRAY                                       ~13     ~12, !3
         16        SEND_VAL                                                 ~13
         17        DO_ICALL                                                 
         18      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/S1WPJ
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $row, !1 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   55     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        FETCH_DIM_R                                      ~2      !0, 'ID'
          3        IS_EQUAL                                         ~3      !1, ~2
          4      > RETURN                                                   ~3
   56     5*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.41 ms | 1000 KiB | 14 Q