Code: Select all
$result = ($value1 - $value2)
if($result > 0) {
echo "<span class='black'>\$$result</span>";
} else {
echo "<span class='red'>(\$$result)</span>";The output is ($-123.45) in red, but I need it to take the minus out and put it in as ($123.45) in red. I tried using absolute value but it causes the value to not trigger as negative obviously.
Sorry for the specific issue but I'm out of ideas with my very limited experience with PHP.
Thanks for any help!