GTK and doubleval
| From: | SIMONE COSCI | Date: | Thu, 11 Sep 2003 10:04:56 +0000 |
| Subject: | GTK and doubleval | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-3861@lists.php.net to get a copy of this message | ||
Hello,
I' ve found a problem about Variables Types using GTK...
Try this code using GTK and without them, I' ve different result ...
I have 2 strings (from DB) $a and $b that represent double values ... if I call gettype($a) return
String ...
I have to cast the Strings in Doubles and add $a to $b obtaining $t ...
Without GTK the result is correct ... 53.99 ...
if I Uncomment the dl() (loading GTK classes) the result become 53 (gtk trim decimals ?)
Try with doubleval() ... same result ...
/*
if (!class_exists('gtk')) {
if (strtoupper(substr(PHP_OS, 0,3) == 'WIN')){
dl('php_gtk.dll') or Die("dll not found");
define("BAR","\\");
define("LFCR","\r\n");
}else{
dl('php_gtk.so') or Die("so not found");
define("BAR","/");
define("LFCR","\n");
}
}
*/
$a = "41.490";
$b = "12.50";
$a = floatval($a);
$b = floatval($b);
$t = $a + $b;
echo floatval($t);
//gtk::main();
Someone can help ?
Tnx
Simone