3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'Network 1' => [ [ 'MSISDN' => 27729554427, 'Network' => 'Network 1', 'Date' => '12-Mar-2016', 'Product' => 'Loan Product 1', 'Amount' => 1000.00 ], [ 'MSISDN' => 27725326345, 'Network' => 'Network 1', 'Date' => '18-Mar-2016', 'Product' => 'Loan Product 2', 'Amount' => 3000.00 ] ], 'Network 2' => [ [ 'MSISDN' => 27722342551, 'Network' => 'Network 2', 'Date' => '16-Mar-2016', 'Product' => 'Loan Product 1', 'Amount' => 500.00 ], [ 'MSISDN' => 27729234533, 'Network' => 'Network 2', 'Date' => '01-Apr-2016', 'Product' => 'Loan Product 1', 'Amount' => 100.00 ] ] ]; foreach ($array as $network => $row) { $result[$network] = $row; $result[$network . ' Total Amount'] = array_sum(array_column($row, 'Amount')); } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 17
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 17
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/L255t
function name:  (null)
number of ops:  22
compiled vars:  !0 = $array, !1 = $row, !2 = $network, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   38     1      > FE_RESET_R                                       $5      !0, ->17
          2    > > FE_FETCH_R                                       ~6      $5, !1, ->17
          3    >   ASSIGN                                                   !2, ~6
   39     4        ASSIGN_DIM                                               !3, !2
          5        OP_DATA                                                  !1
   40     6        CONCAT                                           ~9      !2, '+Total+Amount'
          7        INIT_FCALL                                               'array_sum'
          8        INIT_FCALL                                               'array_column'
          9        SEND_VAR                                                 !1
         10        SEND_VAL                                                 'Amount'
         11        DO_ICALL                                         $11     
         12        SEND_VAR                                                 $11
         13        DO_ICALL                                         $12     
         14        ASSIGN_DIM                                               !3, ~9
         15        OP_DATA                                                  $12
   38    16      > JMP                                                      ->2
         17    >   FE_FREE                                                  $5
   42    18        INIT_FCALL                                               'var_export'
         19        SEND_VAR                                                 !3
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
269.81 ms | 1012 KiB | 16 Q