My code for the fetching of the two values is fine, and the subtracting those values are also fine. The problem is that some values that are going to subtract has comma's(,) and it will echo a wrong answer.
My Code:
<?php
$a = $value['stall_rate'];
$b = $value['payment'];
$result = $a - $b;
echo $result;
?>
As mentioned in the comments. Your database should only hold the number for example 1000 not 1,000.
here's a code snippet:
<?php
$a = 4500;
$b = 5;
$result = $a - $b;
echo number_format($result);
?>
This then outputs 4,495
However here is what you're requesting:
intval(str_replace(',', '', $a)) - intval(str_replace(',', '', $b))