add comma number php code example
Example: sum of numbers with comma php
<?php
$input = "1,2,3,4,5,6,7,8,9,10";
$sum = 0;
$input_arr = explode(",", $input);
print_r(array_sum($input_arr)); #with array function
// without array function
$sum = 0;
foreach($input_arr as $v){
//print "</br>".$v;
$sum = $sum + $v;
}
print "</br>".$sum;
?>