From:             [EMAIL PROTECTED]
Operating system: Debian GNU/Linux 2.2
PHP version:      4.0.6
PHP Bug Type:     XML related
Bug description:  UTF8_ENCODE conflicts with Type Juggling

Hi,

Please take a look at this PHP script.

<?php

for($j=0; $j<1000; $j++) {
  $result=71.95;
  $price=utf8_encode($result);
  $price = $price * 2.2 / 2.2;
  echo "$price<br>\n";

}

?>

This script should just output 1000x exactly the same but as you can see,
the script sometimes returns "71" instead of "71.95".

Seems to have to do something with type juggling. If we explecitly cast
price to a float, ["$price=(float)utf8_encode($result);"] the script
returns only the correct value.
-- 
Edit bug report at: http://bugs.php.net/?id=14349&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to