3v4l.org

run code in 300+ PHP versions simultaneously
<?php $Todaysales = array( array("sale_time"=>"2017-09-10","payment_amount"=>1311.45), array("sale_time"=>"2017-09-10","payment_amount"=>1311.46), array("sale_time"=>"2017-09-10","payment_amount"=>175000.00), array("sale_time"=>"2017-09-11","payment_amount"=>175500.00), ); foreach($Todaysales as $d) { if(isset($data[$d['sale_time']])) $data[$d['sale_time']] += $d['payment_amount']; else $data[$d['sale_time']] = $d['payment_amount']; } $new_data["cols"] ="'".implode("','",array_keys($data))."'"; $new_data["rows"] =implode(",",array_values($data)); print_r($new_data);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 16
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 16
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/DmKsa
function name:  (null)
number of ops:  41
compiled vars:  !0 = $Todaysales, !1 = $d, !2 = $data, !3 = $new_data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    8     1      > FE_RESET_R                                       $5      !0, ->16
          2    > > FE_FETCH_R                                               $5, !1, ->16
   12     3    >   FETCH_DIM_R                                      ~6      !1, 'sale_time'
          4        ISSET_ISEMPTY_DIM_OBJ                         0          !2, ~6
          5      > JMPZ                                                     ~7, ->11
   13     6    >   FETCH_DIM_R                                      ~8      !1, 'sale_time'
          7        FETCH_DIM_R                                      ~10     !1, 'payment_amount'
          8        ASSIGN_DIM_OP                +=               1          !2, ~8
          9        OP_DATA                                                  ~10
   12    10      > JMP                                                      ->15
   15    11    >   FETCH_DIM_R                                      ~11     !1, 'sale_time'
         12        FETCH_DIM_R                                      ~13     !1, 'payment_amount'
         13        ASSIGN_DIM                                               !2, ~11
         14        OP_DATA                                                  ~13
    8    15    > > JMP                                                      ->2
         16    >   FE_FREE                                                  $5
   19    17        INIT_FCALL                                               'implode'
         18        SEND_VAL                                                 '%27%2C%27'
         19        INIT_FCALL                                               'array_keys'
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                         $15     
         22        SEND_VAR                                                 $15
         23        DO_ICALL                                         $16     
         24        CONCAT                                           ~17     '%27', $16
         25        CONCAT                                           ~18     ~17, '%27'
         26        ASSIGN_DIM                                               !3, 'cols'
         27        OP_DATA                                                  ~18
   20    28        INIT_FCALL                                               'implode'
         29        SEND_VAL                                                 '%2C'
         30        INIT_FCALL                                               'array_values'
         31        SEND_VAR                                                 !2
         32        DO_ICALL                                         $20     
         33        SEND_VAR                                                 $20
         34        DO_ICALL                                         $21     
         35        ASSIGN_DIM                                               !3, 'rows'
         36        OP_DATA                                                  $21
   21    37        INIT_FCALL                                               'print_r'
         38        SEND_VAR                                                 !3
         39        DO_ICALL                                                 
         40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.36 ms | 1445 KiB | 17 Q