3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array ( 0 => array ( 'umeta_id' => 3221, 'user_id' => 130, 'meta_key' => 'nickname', 'meta_value' => 'email@domain.com' ), 1 => array ( 'umeta_id' => 3222, 'user_id' => 130, 'meta_key' => 'first_name', 'meta_value' => 'Jim' ), 2 => array ( 'umeta_id' => 3223, 'user_id' => 130, 'meta_key' => 'last_name', 'meta_value' => 'Jones' ) ); function get_value($array, $key) { $k = array_search($key, array_column($array, 'meta_key')); if ($k !== false) return $array[$k]['meta_value']; else return ''; } echo get_value($array, 'first_name') . PHP_EOL; echo get_value($array, 'nickname') . PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rVQg9
function name:  (null)
number of ops:  14
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   35     1        INIT_FCALL                                               'get_value'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'first_name'
          4        DO_FCALL                                      0  $2      
          5        CONCAT                                           ~3      $2, '%0A'
          6        ECHO                                                     ~3
   36     7        INIT_FCALL                                               'get_value'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 'nickname'
         10        DO_FCALL                                      0  $4      
         11        CONCAT                                           ~5      $4, '%0A'
         12        ECHO                                                     ~5
   37    13      > RETURN                                                   1

Function get_value:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 17
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rVQg9
function name:  get_value
number of ops:  19
compiled vars:  !0 = $array, !1 = $key, !2 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   28     2        INIT_FCALL                                               'array_search'
          3        SEND_VAR                                                 !1
          4        INIT_FCALL                                               'array_column'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 'meta_key'
          7        DO_ICALL                                         $3      
          8        SEND_VAR                                                 $3
          9        DO_ICALL                                         $4      
         10        ASSIGN                                                   !2, $4
   29    11        TYPE_CHECK                                  1018          !2
         12      > JMPZ                                                     ~6, ->17
   30    13    >   FETCH_DIM_R                                      ~7      !0, !2
         14        FETCH_DIM_R                                      ~8      ~7, 'meta_value'
         15      > RETURN                                                   ~8
   29    16*       JMP                                                      ->18
   32    17    > > RETURN                                                   ''
   33    18*     > RETURN                                                   null

End of function get_value

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.28 ms | 1006 KiB | 17 Q