3v4l.org

run code in 300+ PHP versions simultaneously
<?php function rpcKeyValToAssoc(array $data) { $output = []; foreach ($member as $m) { $value = $m['value']; $output[$m['name']] = $value[key($value)]; } return $output; } $data = [ 'methodResponse' => [ 'params' => [ 'param' => [ 'value' => [ 'struct' => [ 'member' => [ 'name' => 'member_id', 'value' => [ 'string' => 4958 ] ], [ 'name' => 'name', 'value' => [ 'string' => 'Username', ] ] ] ] ] ] ] ]; $member = rpcKeyValToAssic($data['methodResponse']['params']['param']['value']['struct']['member']);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TCB7M
function name:  (null)
number of ops:  13
compiled vars:  !0 = $data, !1 = $member
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, <array>
   43     1        INIT_FCALL_BY_NAME                                       'rpcKeyValToAssic'
          2        CHECK_FUNC_ARG                                           
          3        FETCH_DIM_FUNC_ARG                               $3      !0, 'methodResponse'
          4        FETCH_DIM_FUNC_ARG                               $4      $3, 'params'
          5        FETCH_DIM_FUNC_ARG                               $5      $4, 'param'
          6        FETCH_DIM_FUNC_ARG                               $6      $5, 'value'
          7        FETCH_DIM_FUNC_ARG                               $7      $6, 'struct'
          8        FETCH_DIM_FUNC_ARG                               $8      $7, 'member'
          9        SEND_FUNC_ARG                                            $8
         10        DO_FCALL                                      0  $9      
         11        ASSIGN                                                   !1, $9
         12      > RETURN                                                   1

Function rpckeyvaltoassoc:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 14
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/TCB7M
function name:  rpcKeyValToAssoc
number of ops:  17
compiled vars:  !0 = $data, !1 = $output, !2 = $member, !3 = $m, !4 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, <array>
    6     2      > FE_RESET_R                                       $6      !2, ->14
          3    > > FE_FETCH_R                                               $6, !3, ->14
    7     4    >   FETCH_DIM_R                                      ~7      !3, 'value'
          5        ASSIGN                                                   !4, ~7
    9     6        FETCH_DIM_R                                      ~9      !3, 'name'
          7        INIT_FCALL                                               'key'
          8        SEND_VAR                                                 !4
          9        DO_ICALL                                         $11     
         10        FETCH_DIM_R                                      ~12     !4, $11
         11        ASSIGN_DIM                                               !1, ~9
         12        OP_DATA                                                  ~12
    6    13      > JMP                                                      ->3
         14    >   FE_FREE                                                  $6
   12    15      > RETURN                                                   !1
   13    16*     > RETURN                                                   null

End of function rpckeyvaltoassoc

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
183.57 ms | 1396 KiB | 15 Q