3v4l.org

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

Function addarrays:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G5OAq
function name:  addArrays
number of ops:  8
compiled vars:  !0 = $input, !1 = $output
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:
176.89 ms | 1399 KiB | 24 Q