note 103678 deleted from language.types.float by danbrown

From: Date: Wed, 27 Apr 2011 22:13:09 +0000
Subject: note 103678 deleted from language.types.float by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-179209@lists.php.net to get a copy of this message
Note Submitter: maxiumswarp at gmail dot com ---- I found that to compare floats correctly I had to use this, it works very good for doing price comparison, such as order validation to make sure final prices are correct before they send. This is make your statements return true are false correctly. $number1=number_format($float1,2,'.',''); $number2=number_format($float2,2,'.'''); if($number1!=$number2){ echo 'do correction here!'; }

« previous php.notes (#179209) next »