3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( array('date' => '09-04-2018','item' => 'player 1', 'score' => '1'), array('date' => '09-04-2018','item' => 'player 2', 'score' => '2'), array('date' => '10-04-2018','item' => 'player 1', 'score' => '1'), array('date' => '10-04-2018','item' => 'player 2', 'score' => '2'), array('date' => '16-04-2018','item' => 'player 1', 'score' => '3'), array('date' => '16-04-2018','item' => 'player 2', 'score' => '4'), array('date' => '17-04-2018','item' => 'player 1', 'score' => '3'), array('date' => '17-04-2018','item' => 'player 2', 'score' => '4') ); //Week example Foreach($arr as $val){ $res[$val['item']][date("F", strtotime($val['date']))][] = $val['score']; } Var_dump($res);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 18
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 18
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/MUjYV
function name:  (null)
number of ops:  23
compiled vars:  !0 = $arr, !1 = $val, !2 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   16     1      > FE_RESET_R                                       $4      !0, ->18
          2    > > FE_FETCH_R                                               $4, !1, ->18
   17     3    >   FETCH_DIM_R                                      ~5      !1, 'item'
          4        INIT_FCALL                                               'date'
          5        SEND_VAL                                                 'F'
          6        INIT_FCALL                                               'strtotime'
          7        FETCH_DIM_R                                      ~7      !1, 'date'
          8        SEND_VAL                                                 ~7
          9        DO_ICALL                                         $8      
         10        SEND_VAR                                                 $8
         11        DO_ICALL                                         $9      
         12        FETCH_DIM_R                                      ~12     !1, 'score'
         13        FETCH_DIM_W                                      $6      !2, ~5
         14        FETCH_DIM_W                                      $10     $6, $9
         15        ASSIGN_DIM                                               $10
         16        OP_DATA                                                  ~12
   16    17      > JMP                                                      ->2
         18    >   FE_FREE                                                  $4
   19    19        INIT_FCALL                                               'var_dump'
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
135.41 ms | 1002 KiB | 16 Q