3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = <<<JSON { "created_time": "2019-10-28T03:02:49+0000", "id": "2505284979588949", "field_data": [ { "name": "groupID", "values": [ "a3da23rad6" ] }, { "name": "email", "values": [ "edwardnorton@gmail.com" ] }, { "name": "first_name", "values": [ "Edward" ] } ] } JSON; $data = json_decode($json, true); $fields = array_reduce($data['field_data'], static function ($fields, $entry) { $fields[$entry['name']] = $entry['values']; return $fields; }); print_r($fields);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kTl1M
function name:  (null)
number of ops:  17
compiled vars:  !0 = $json, !1 = $data, !2 = $fields
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%7B%0A++%22created_time%22%3A+%222019-10-28T03%3A02%3A49%2B0000%22%2C%0A++%22id%22%3A+%222505284979588949%22%2C%0A++%22field_data%22%3A+%5B%0A++++%7B+%22name%22%3A+%22groupID%22%2C+%22values%22%3A+%5B+%22a3da23rad6%22+%5D+%7D%2C%0A++++%7B+%22name%22%3A+%22email%22%2C+%22values%22%3A+%5B+%22edwardnorton%40gmail.com%22+%5D+%7D%2C%0A++++%7B+%22name%22%3A+%22first_name%22%2C+%22values%22%3A+%5B+%22Edward%22+%5D+%7D%0A++%5D%0A%7D'
   14     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
   16     6        INIT_FCALL                                               'array_reduce'
          7        FETCH_DIM_R                                      ~6      !1, 'field_data'
          8        SEND_VAL                                                 ~6
          9        DECLARE_LAMBDA_FUNCTION                          ~7      [0]
   19    10        SEND_VAL                                                 ~7
   16    11        DO_ICALL                                         $8      
         12        ASSIGN                                                   !2, $8
   21    13        INIT_FCALL                                               'print_r'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
         16      > 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/kTl1M
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $fields, !1 = $entry
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   17     2        FETCH_DIM_R                                      ~2      !1, 'name'
          3        FETCH_DIM_R                                      ~4      !1, 'values'
          4        ASSIGN_DIM                                               !0, ~2
          5        OP_DATA                                                  ~4
   18     6      > RETURN                                                   !0
   19     7*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.87 ms | 1013 KiB | 16 Q