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 to get a value of 'shop_nam'e where 'user_id' = 123456789;*/ $user_id = '765754346'; $shop_name = ''; array_walk($arr['igive'], function($v, $k) use (&$shop_name, $user_id){ ($v['user_id'] == $user_id) ? ($shop_name = $v['shop_name']) : ''; }); echo $shop_name;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Be4Ab
function name:  (null)
number of ops:  13
compiled vars:  !0 = $arr, !1 = $user_id, !2 = $shop_name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   28     1        ASSIGN                                                   !1, '765754346'
   29     2        ASSIGN                                                   !2, ''
   30     3        INIT_FCALL                                               'array_walk'
          4        FETCH_DIM_W                                      $6      !0, 'igive'
          5        SEND_REF                                                 $6
          6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FBe4Ab%3A30%240'
          7        BIND_LEXICAL                                             ~7, !2
          8        BIND_LEXICAL                                             ~7, !1
   32     9        SEND_VAL                                                 ~7
         10        DO_ICALL                                                 
   33    11        ECHO                                                     !2
   34    12      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FBe4Ab%3A30%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.86 ms | 1396 KiB | 15 Q