note 50442 added to function.intval

From: Date: Mon, 28 Feb 2005 18:08:24 +0000
Subject: note 50442 added to function.intval
Groups: php.notes 
Request: Send a blank email to php-notes+get-85682@lists.php.net to get a copy of this message
Bug on intval? <?php $value = "150,45"; $value = str_replace(",", ".", $value) * 100; echo $value. "<BR>"; // output 15045 $value = intval($value); echo $value; // output 15044 ??? why? ?> I think it happens cause my initial $value is a string . But when I multiply by 100 this value converts in a decimal. So take care. PHP 4.3.9 ---- Manual Page -- http://www.php.net/manual/en/function.intval.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+50442 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50442&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50442&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50442&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50442&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50442&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+50442&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#85682) next »