how to do a sum on a string in php?

前端 未结 5 1075
忘掉有多难
忘掉有多难 2021-01-18 14:58

i have a simple question:

i have this var: $v = \"24000,1500,1500,1500,1500,1500,\";

i would like to add those numbers together.

i\'ve

5条回答
  •  轮回少年
    2021-01-18 15:56

    Use str_getcsv to obtain an array of the values. Then loop through the array to sum those values.

提交回复
热议问题