Good Morning,

I am looking for some code that will simply echo "0" when the result is negative. I dont want it to output a negative number.

Here is the line I am looking to add this to:

echo $row['GP1011_'.$wk.'']-$row['GP1011_'.$prev.''];

Any help is appreciated.
Thanks
Chris

$diff = $row['GP1011_'.$wk.''] - $row['GP1011_'.$prev.''];

// compact-nerdy style:
echo ($diff > 0) ? $diff : 0;

// or, for better reading:
if ($diff > 0) {
    echo $diff;  
} else {
    echo 0;
}
commented: thanks +1