3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array ( 0 => array ( 'reference_no' => 'A0012', 'code' => 'HSWH30', 'net_unit_price' => '24000', 'quantity' => '2', ), 1 => array ( 'reference_no' => 'A0012', 'code' => 'HSWH15', 'net_unit_price' => '21000', 'quantity' => '2', ), 2 => array ( 'reference_no' => 'A0013', 'code' => 'HS-106AR', 'net_unit_price' => '2400', 'quantity' => '1', ), 3 => array ( 'reference_no' => 'A0013', 'code' => 'HS-8012', 'net_unit_price' => '4500', 'quantity' => '2', ), ); foreach($arr as $sub){ $new[$sub['reference_no']][] = $sub; } $new = array_values($new); var_dump($new);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 8
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/DQEmC
function name:  (null)
number of ops:  17
compiled vars:  !0 = $arr, !1 = $sub, !2 = $new
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   34     1      > FE_RESET_R                                       $4      !0, ->8
          2    > > FE_FETCH_R                                               $4, !1, ->8
   35     3    >   FETCH_DIM_R                                      ~5      !1, 'reference_no'
          4        FETCH_DIM_W                                      $6      !2, ~5
          5        ASSIGN_DIM                                               $6
          6        OP_DATA                                                  !1
   34     7      > JMP                                                      ->2
          8    >   FE_FREE                                                  $4
   37     9        INIT_FCALL                                               'array_values'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                         $8      
         12        ASSIGN                                                   !2, $8
   38    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.13 ms | 1000 KiB | 15 Q