note 106017 deleted from function.intval by danbrown

From: Date: Mon, 03 Oct 2011 13:10:30 +0000
Subject: note 106017 deleted from function.intval by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-183598@lists.php.net to get a copy of this message
Note Submitter: wgh ---- Someone can tell me why <?php $full = str_replace("€ ", "", "€ 10.50"); $discounted = str_replace("€ ", "", "€ 8.40"); $full = floatval($full); $discounted = floatval($discounted); echo $percent = ($full - $discounted) / $full; echo $percent = intval($percent * 100); ?> The result of the 2 echos is • 0.2 • 19 Why I get 19 and not 20?!

« previous php.notes (#183598) next »