3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = <<<DATA [ { "user_id": "7", "field": "1", "value": "45" }, { "user_id": "10", "field": "1", "value": "53" }, { "user_id": "7", "field": "2", "value": "40" }, { "user_id": "10", "field": "2", "value": "45" }, { "user_id": "7", "field": "3", "value": "65" }, { "user_id": "10", "field": "3", "value": "69" }, { "user_id": "7", "field": "4", "value": "14" }, { "user_id": "10", "field": "4", "value": "13" } ] DATA; $arrays = json_decode($data, true); $results = []; foreach ($arrays as $value) { $results[$value['user_id']][] = $value['value']; } echo "<table>"; foreach ($results as $key => $result) { echo "<tr><td>$key</td>"; foreach ($result as $col) { echo "<td>$col</td>"; } echo "</tr>"; } echo "</table>";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 15
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 15
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 15
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 34
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 34
Branch analysis from position: 19
2 jumps found. (Code = 77) Position 1 = 25, Position 2 = 31
Branch analysis from position: 25
2 jumps found. (Code = 78) Position 1 = 26, Position 2 = 31
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 31
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
Branch analysis from position: 15
filename:       /in/7ZF5T
function name:  (null)
number of ops:  37
compiled vars:  !0 = $data, !1 = $arrays, !2 = $results, !3 = $value, !4 = $result, !5 = $key, !6 = $col
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%5B%0A++++%7B%0A++++++++%22user_id%22%3A+%227%22%2C%0A++++++++%22field%22%3A+%221%22%2C%0A++++++++%22value%22%3A+%2245%22%0A++++%7D%2C%0A++++%7B%0A++++++++%22user_id%22%3A+%2210%22%2C%0A++++++++%22field%22%3A+%221%22%2C%0A++++++++%22value%22%3A+%2253%22%0A++++%7D%2C%0A++++%7B%0A++++++++%22user_id%22%3A+%227%22%2C%0A++++++++%22field%22%3A+%222%22%2C%0A++++++++%22value%22%3A+%2240%22%0A++++%7D%2C%0A++++%7B%0A++++++++%22user_id%22%3A+%2210%22%2C%0A++++++++%22field%22%3A+%222%22%2C%0A++++++++%22value%22%3A+%2245%22%0A++++%7D%2C%0A++++%7B%0A++++++++%22user_id%22%3A+%227%22%2C%0A++++++++%22field%22%3A+%223%22%2C%0A++++++++%22value%22%3A+%2265%22%0A++++%7D%2C%0A++++%7B%0A++++++++%22user_id%22%3A+%2210%22%2C%0A++++++++%22field%22%3A+%223%22%2C%0A++++++++%22value%22%3A+%2269%22%0A++++%7D%2C%0A++++%7B%0A++++++++%22user_id%22%3A+%227%22%2C%0A++++++++%22field%22%3A+%224%22%2C%0A++++++++%22value%22%3A+%2214%22%0A++++%7D%2C%0A++++%7B%0A++++++++%22user_id%22%3A+%2210%22%2C%0A++++++++%22field%22%3A+%224%22%2C%0A++++++++%22value%22%3A+%2213%22%0A++++%7D%0A%5D'
   48     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $8      
          5        ASSIGN                                                   !1, $8
   49     6        ASSIGN                                                   !2, <array>
   51     7      > FE_RESET_R                                       $11     !1, ->15
          8    > > FE_FETCH_R                                               $11, !3, ->15
   52     9    >   FETCH_DIM_R                                      ~12     !3, 'user_id'
         10        FETCH_DIM_R                                      ~15     !3, 'value'
         11        FETCH_DIM_W                                      $13     !2, ~12
         12        ASSIGN_DIM                                               $13
         13        OP_DATA                                                  ~15
   51    14      > JMP                                                      ->8
         15    >   FE_FREE                                                  $11
   55    16        ECHO                                                     '%3Ctable%3E'
   56    17      > FE_RESET_R                                       $16     !2, ->34
         18    > > FE_FETCH_R                                       ~17     $16, !4, ->34
         19    >   ASSIGN                                                   !5, ~17
   57    20        ROPE_INIT                                     3  ~20     '%3Ctr%3E%3Ctd%3E'
         21        ROPE_ADD                                      1  ~20     ~20, !5
         22        ROPE_END                                      2  ~19     ~20, '%3C%2Ftd%3E'
         23        ECHO                                                     ~19
   58    24      > FE_RESET_R                                       $22     !4, ->31
         25    > > FE_FETCH_R                                               $22, !6, ->31
   59    26    >   ROPE_INIT                                     3  ~24     '%3Ctd%3E'
         27        ROPE_ADD                                      1  ~24     ~24, !6
         28        ROPE_END                                      2  ~23     ~24, '%3C%2Ftd%3E'
         29        ECHO                                                     ~23
   58    30      > JMP                                                      ->25
         31    >   FE_FREE                                                  $22
   61    32        ECHO                                                     '%3C%2Ftr%3E'
   56    33      > JMP                                                      ->18
         34    >   FE_FREE                                                  $16
   63    35        ECHO                                                     '%3C%2Ftable%3E'
         36      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.73 ms | 1003 KiB | 14 Q