cwoodman Posted March 2, 2015 Share Posted March 2, 2015 This simple bit of code gives ridiculous answers... echo $Total;echo "<br>";echo $PrevTotal;echo "<br>";echo $Total-$PrevTotal; Example output: 3164,445312 or 1,395646-645 Any idea why? Quote Link to comment Share on other sites More sharing options...
Barand Posted March 2, 2015 Share Posted March 2, 2015 (edited) Numeric variables should not contain formatting characters such as commas. Same goes for values held in a db table. 4,100 is treated as 4 (only numeric digits up to the first non-numeric digit) Format the numbers on output Edited March 2, 2015 by Barand Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.