I found this problem, when I was trying to benchmark my code. It seems that BC Math extension, which is built-in to PHP since version 4.? does not work properly with PHP GTK.
I tried this example both with PHP-GTK and regular PHP and I get different results. I am not sure if this is a missing feature or a bug. My installation is PHP-GTK 2.0.1 from gtk.php.net (binary and extensions).
bcsub (or any other BC Math) function exists, it just doesn't work. I even tried supplying floats directly as arguments - always returns 0.000000.
die('BC Math not present!');
$a = microtime(true); //start time -
// with true argument returns a float unix timestamp with microseconds as a decimal
usleep(0.5 * 1000000); //sleep for half a second
$b = microtime(true); //end time
echo "$a versus $b\n"; // just checking if the values are correct
$substract = $b - $a; // substracting them "manually"
$bcsubstract = bcsub($b, $a, 6); // this should be better than substraction, as it provides more useful results
echo "substracted: $substract\n".
"bcsubbed: $bcsubstract"; //just dumping the result
yield with PHP 5.2.9 - as expected:
1243685894.4375 versus 1243685894.9369
yield with PHP-GTK 5.2.5 - not as expected:
1243685972,5313 versus 1243685973,0305
bcsubbed: 0.000000 //should be 499223