3v4l.org

run code in 300+ PHP versions simultaneously
<?php $response ='[ { "userSummaries": [ { "id": "9910", "status": "Active", "name": "Jhon" } ] }, { "userSummaries": [ { "id": "8754", "status": "Active", "name": "Jane" } ] } ]'; $myArr = json_decode($response, true); $result_arr = []; array_walk($myArr,function($v,$k) use (&$result_arr){ $result_arr[key($v)] = $v[key($v)]; }); echo json_encode($result_arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tVkK5
function name:  (null)
number of ops:  18
compiled vars:  !0 = $response, !1 = $myArr, !2 = $result_arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%5B%0A++++%7B%0A++++++++%22userSummaries%22%3A+%5B%0A++++++++++++%7B%0A++++++++++++++++%22id%22%3A+%229910%22%2C%0A++++++++++++++++%22status%22%3A+%22Active%22%2C%0A++++++++++++++++%22name%22%3A+%22Jhon%22%0A++++++++++++%7D%0A++++++++%5D%0A++++%7D%2C%0A++++%7B%0A++++++++%22userSummaries%22%3A+%5B%0A++++++++++++%7B%0A++++++++++++++++%22id%22%3A+%228754%22%2C%0A++++++++++++++++%22status%22%3A+%22Active%22%2C%0A++++++++++++++++%22name%22%3A+%22Jane%22%0A++++++++++++%7D%0A++++++++%5D%0A++++%7D%0A%5D'
   24     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
   26     6        ASSIGN                                                   !2, <array>
   28     7        INIT_FCALL                                               'array_walk'
          8        SEND_REF                                                 !1
          9        DECLARE_LAMBDA_FUNCTION                          ~7      [0]
         10        BIND_LEXICAL                                             ~7, !2
   30    11        SEND_VAL                                                 ~7
   28    12        DO_ICALL                                                 
   33    13        INIT_FCALL                                               'json_encode'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                         $9      
         16        ECHO                                                     $9
         17      > 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/tVkK5
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $v, !1 = $k, !2 = $result_arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   29     3        INIT_FCALL                                               'key'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $3      
          6        INIT_FCALL                                               'key'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $5      
          9        FETCH_DIM_R                                      ~6      !0, $5
         10        ASSIGN_DIM                                               !2, $3
         11        OP_DATA                                                  ~6
   30    12      > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.29 ms | 1457 KiB | 17 Q