3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ ['TS001' => 585.81, 'TS002' => 3110.1, 'TS003' => 8763, 'TS004' => 14497.71, 'TS005' => 16695.24, 'TS006' => 8178.68, 'TS007' => 15878.4, 'TS008' => 4140.36, 'TS009' => 3196.96, 'TS010' => 1776.3, 'TS011' => 1916.16], ['TS001' => 0, 'TS002' => 0, 'TS003' => 0, 'TS004' => 0, 'TS005' => 0, 'TS006' => 11906.4, 'TS007' => 22636.8, 'TS008' => 5798.52, 'TS009' => 0, 'TS010' => 2250.9, 'TS011' => 2419.992] ]; $array2 = [ 'TS001', 'TS002', 'TS003', 'TS004', 'TS005', 'TS009' ]; $result = []; foreach ($array1 as $index => $item) { $result[$index] = array_sum(array_diff_key($item, array_flip($array2))); } print_r($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 19
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 19
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/FrpsD
function name:  (null)
number of ops:  24
compiled vars:  !0 = $array1, !1 = $array2, !2 = $result, !3 = $item, !4 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    7     1        ASSIGN                                                   !1, <array>
    8     2        ASSIGN                                                   !2, <array>
   10     3      > FE_RESET_R                                       $8      !0, ->19
          4    > > FE_FETCH_R                                       ~9      $8, !3, ->19
          5    >   ASSIGN                                                   !4, ~9
   11     6        INIT_FCALL                                               'array_sum'
          7        INIT_FCALL                                               'array_diff_key'
          8        SEND_VAR                                                 !3
          9        INIT_FCALL                                               'array_flip'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $12     
         12        SEND_VAR                                                 $12
         13        DO_ICALL                                         $13     
         14        SEND_VAR                                                 $13
         15        DO_ICALL                                         $14     
         16        ASSIGN_DIM                                               !2, !4
         17        OP_DATA                                                  $14
   10    18      > JMP                                                      ->4
         19    >   FE_FREE                                                  $8
   14    20        INIT_FCALL                                               'print_r'
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
264.44 ms | 1008 KiB | 17 Q