3v4l.org

run code in 300+ PHP versions simultaneously
<?php function addArrays($output,$input) { return array_sum(func_get_args()); } $output = array(0,0,0,0,0); $testdata = "580,680,480,380"; $input = explode(",", $testdata); $subtotal = array_sum(explode(",", $testdata)); $output = array_map(addArrays(), $output, array_push($input,$subTotal)); var_dump($output); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TUTjm
function name:  (null)
number of ops:  31
compiled vars:  !0 = $output, !1 = $testdata, !2 = $input, !3 = $subtotal, !4 = $subTotal
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, <array>
    8     1        ASSIGN                                                   !1, '580%2C680%2C480%2C380'
    9     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '%2C'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $7      
          6        ASSIGN                                                   !2, $7
   10     7        INIT_FCALL                                               'array_sum'
          8        INIT_FCALL                                               'explode'
          9        SEND_VAL                                                 '%2C'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $9      
         12        SEND_VAR                                                 $9
         13        DO_ICALL                                         $10     
         14        ASSIGN                                                   !3, $10
   11    15        INIT_FCALL                                               'array_map'
         16        INIT_FCALL                                               'addarrays'
         17        DO_FCALL                                      0  $12     
         18        SEND_VAR                                                 $12
         19        SEND_VAR                                                 !0
         20        INIT_FCALL                                               'array_push'
         21        SEND_REF                                                 !2
         22        SEND_VAR                                                 !4
         23        DO_ICALL                                         $13     
         24        SEND_VAR                                                 $13
         25        DO_ICALL                                         $14     
         26        ASSIGN                                                   !0, $14
   12    27        INIT_FCALL                                               'var_dump'
         28        SEND_VAR                                                 !0
         29        DO_ICALL                                                 
   14    30      > RETURN                                                   1

Function addarrays:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TUTjm
function name:  addArrays
number of ops:  8
compiled vars:  !0 = $output, !1 = $input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        INIT_FCALL                                               'array_sum'
          3        FUNC_GET_ARGS                                    ~2      
          4        SEND_VAL                                                 ~2
          5        DO_ICALL                                         $3      
          6      > RETURN                                                   $3
    5     7*     > RETURN                                                   null

End of function addarrays

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.96 ms | 1399 KiB | 24 Q