Dumb Question - Casting

From: Date: Thu, 18 Feb 2010 15:47:48 +0000
Subject: Dumb Question - Casting
Groups: php.general 
Request: Send a blank email to php-general+get-302173@lists.php.net to get a copy of this message
Sorry, been doing heavy perl and haven't written any PHP in 3 years so a tad rusty. Can someone explain why the second expression in this code snippet evaluates to 7 and not 8? $a = (int) (0.1 +0.7); echo "$a\n"; $x = (int) ((0.1 + 0.7) * 10); echo "$x\n"; $y = (int) (8); echo "$y\n";

« previous php.general (#302173) next »