I just ran this code on my server:
<?php
$first = array(100,25,"1,000");
$second = array(100,25,"1000");
$third = array(100,25,1000);
$inputs = array($first,$second,$third);
foreach($inputs as $cur_input) {
echo "Function Input:<br>";
echo " \$repT = " . $cur_input[0] . "<br>";
echo " \$litT = " . $cur_input[1] . "<br>";
echo " \$price = " . $cur_input[2] . "<br><br>";
$output = totals($cur_input[0],$cur_input[1],$cur_input[2]);
echo "Function Output:<br>";
echo " Brick Price = " . $output['brick_price'] . "<br>";
echo " Subtotal = " . $output['subtotal'] . "<br>";
echo " Total = " . $output['total'] . "<br><br>";
}
function totals($repT,$litT,$price) {
$subT = $repT + $litT;
$o_total = $price;
$final_total = round($subT + $o_total);
return array('brick_price' => $o_total,'subtotal' => $subT,'total'=> $final_total);
}
?>
And it yielded this result set:
Function Input:
$repT = 100
$litT = 25
$price = 1,000
Function Output:
Brick Price = 1,000
Subtotal = 125
Total = 126
Function Input:
$repT = 100
$litT = 25
$price = 1000
Function Output:
Brick Price = 1000
Subtotal = 125
Total = 1125
Function Input:
$repT = 100
$litT = 25
$price = 1000
Function Output:
Brick Price = 1000
Subtotal = 125
Total = 1125
I don't know what you're doing wrong. But my data shows that if you use a comma you get 126 and it you do not use a comma you donot get 126. So it seems that you should take the comma out.