3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* @link http://stackoverflow.com/q/15931375/2261774 */ error_reporting(~0); $array = array( array('Jan 2010', 65.75), array('Jan 2010', 211.05), array('Jan 2010', 582.7), array('Feb 2010', 136.3), array('Feb 2010', 215.32), array('Feb 2010', 413.9), array('Mar 2010', 156.35), array('Mar 2010', 210.54), array('Mar 2010', 585.15), array('Apr 2010', 126.1), array('Apr 2010', 255.47), array('Apr 2010', 329.1), array('May 2010', 109), array('May 2010', 170), array('May 2010', 716.7), ); foreach($array as $key => &$entry) { list($month, $value) = $entry; if (isset($ptr[$month])) { $ptr[$month][] = $value; unset($array[$key]); } else { $ptr[$month] = &$entry; } } unset($ptr); print_r($array);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 5, Position 2 = 23
Branch analysis from position: 5
2 jumps found. (Code = 126) Position 1 = 6, Position 2 = 23
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 20
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/pgaoh
function name:  (null)
number of ops:  29
compiled vars:  !0 = $array, !1 = $entry, !2 = $key, !3 = $month, !4 = $value, !5 = $ptr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 -1
          2        DO_ICALL                                                 
    6     3        ASSIGN                                                   !0, <array>
   24     4      > FE_RESET_RW                                      $8      !0, ->23
          5    > > FE_FETCH_RW                                      ~9      $8, !1, ->23
          6    >   ASSIGN                                                   !2, ~9
   25     7        QM_ASSIGN                                        ~11     !1
          8        FETCH_LIST_R                                     $12     ~11, 0
          9        ASSIGN                                                   !3, $12
         10        FETCH_LIST_R                                     $14     ~11, 1
         11        ASSIGN                                                   !4, $14
         12        FREE                                                     ~11
   26    13        ISSET_ISEMPTY_DIM_OBJ                         0          !5, !3
         14      > JMPZ                                                     ~16, ->20
   27    15    >   FETCH_DIM_W                                      $17     !5, !3
         16        ASSIGN_DIM                                               $17
         17        OP_DATA                                                  !4
   28    18        UNSET_DIM                                                !0, !2
         19      > JMP                                                      ->22
   30    20    >   FETCH_DIM_W                                      $19     !5, !3
         21        ASSIGN_REF                                               $19, !1
   24    22    > > JMP                                                      ->5
         23    >   FE_FREE                                                  $8
   33    24        UNSET_CV                                                 !5
   35    25        INIT_FCALL                                               'print_r'
         26        SEND_VAR                                                 !0
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.84 ms | 1396 KiB | 17 Q