3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = [ 'datasetTransactionsOrders' => [ [ 'seriesname' => 'Автоклуб', 'value' => '2' ], [ 'seriesname' => 'Скидка 10%', 'value' => '1' ], [ 'seriesname' => 'Скидка 10%', 'value' => '17' ] ] ]; $new = []; foreach ($array['datasetTransactionsOrders'] as $key => &$value) { $new[$value['seriesname']]['seriesname'] = $value['seriesname']; $new[$value['seriesname']]['data'][$key]['value'] = $value['value']; } $new = array_values($new); print_r($new);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 4, Position 2 = 19
Branch analysis from position: 4
2 jumps found. (Code = 126) Position 1 = 5, Position 2 = 19
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/05d8Q
function name:  (null)
number of ops:  28
compiled vars:  !0 = $array, !1 = $new, !2 = $value, !3 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   20     1        ASSIGN                                                       !1, <array>
   22     2        FETCH_DIM_W                                          $6      !0, 'datasetTransactionsOrders'
          3      > FE_RESET_RW                                          $7      $6, ->19
          4    > > FE_FETCH_RW                                          ~8      $7, !2, ->19
          5    >   ASSIGN                                                       !3, ~8
   24     6        FETCH_DIM_R                                          ~10     !2, 'seriesname'
          7        FETCH_DIM_R                                          ~13     !2, 'seriesname'
          8        FETCH_DIM_W                                          $11     !1, ~10
          9        ASSIGN_DIM                                                   $11, 'seriesname'
         10        OP_DATA                                                      ~13
   25    11        FETCH_DIM_R                                          ~14     !2, 'seriesname'
         12        FETCH_DIM_R                                          ~19     !2, 'value'
         13        FETCH_DIM_W                                          $15     !1, ~14
         14        FETCH_DIM_W                                          $16     $15, 'data'
         15        FETCH_DIM_W                                          $17     $16, !3
         16        ASSIGN_DIM                                                   $17, 'value'
         17        OP_DATA                                                      ~19
   22    18      > JMP                                                          ->4
         19    >   FE_FREE                                                      $7
   28    20        INIT_FCALL                                                   'array_values'
         21        SEND_VAR                                                     !1
         22        DO_ICALL                                             $20     
         23        ASSIGN                                                       !1, $20
   29    24        INIT_FCALL                                                   'print_r'
         25        SEND_VAR                                                     !1
         26        DO_ICALL                                                     
         27      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
149.59 ms | 1707 KiB | 10 Q