3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array ( 'igive' => array ( 0 => array ( 'name' => 'Alex', 'shop_name' => 'Shop1', 'rights' => 'admin', 'who_use' => '', 'user_id' => '765754346', ), 1 => array ( 'name' => 'Dmitry', 'shop_name' => 'Shop2', 'rights' => 'manager', 'who_use' => '', 'user_id' => '123456789', ), ), 'giventome' => array ( ), ); /*How can i set value (1, for example) for a key 'who_use' where 'user_id' = 765754346?*/ $user_id = '765754346'; array_walk($arr['igive'], function($v, $k) use (&$arr, $user_id){ ($arr['igive'][$k]['user_id'] == $user_id) ? ($arr['igive'][$k]['who_use'] = 1) : ''; }); print_r($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/P8L79
function name:  (null)
number of ops:  14
compiled vars:  !0 = $arr, !1 = $user_id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   28     1        ASSIGN                                                   !1, '765754346'
   29     2        INIT_FCALL                                               'array_walk'
          3        FETCH_DIM_W                                      $4      !0, 'igive'
          4        SEND_REF                                                 $4
          5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FP8L79%3A29%240'
          6        BIND_LEXICAL                                             ~5, !0
          7        BIND_LEXICAL                                             ~5, !1
   31     8        SEND_VAL                                                 ~5
          9        DO_ICALL                                                 
   32    10        INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FP8L79%3A29%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 15
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/P8L79
function name:  {closure}
number of ops:  18
compiled vars:  !0 = $v, !1 = $k, !2 = $arr, !3 = $user_id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        BIND_STATIC                                              !3
   30     4        FETCH_DIM_R                                      ~4      !2, 'igive'
          5        FETCH_DIM_R                                      ~5      ~4, !1
          6        FETCH_DIM_R                                      ~6      ~5, 'user_id'
          7        IS_EQUAL                                                 !3, ~6
          8      > JMPZ                                                     ~7, ->15
          9    >   FETCH_DIM_W                                      $8      !2, 'igive'
         10        FETCH_DIM_W                                      $9      $8, !1
         11        ASSIGN_DIM                                       ~10     $9, 'who_use'
         12        OP_DATA                                                  1
         13        QM_ASSIGN                                        ~11     ~10
         14      > JMP                                                      ->16
         15    >   QM_ASSIGN                                        ~11     ''
         16    >   FREE                                                     ~11
   31    17      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FP8L79%3A29%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.15 ms | 1396 KiB | 17 Q