Bankers' RoundThis Bankers' Rounding function takes uses pseudo-int math to eliminate issues related to float math, and rounds to the specified precision. Limited by the size of your (int). function bround( $value, $precision )
{ // http://sites.google.com/site/cjastram $factor = pow( 10, $precision ); $a = $value;
$a = $a * $factor; $dec = (int) floor( $a ); $frac = $a - $dec; $extra = (int) floor( $frac * 10 ); if( $extra > 5 ) { $dec++; } elseif( $extra == 5 ) { if( $dec & 1 ) { // odd, round up
$dec++; } } return $dec / $factor;
}
PHPUnit under Windows 7This assumes your PHP install dir is C:\PHP. If you accepted the defaults when installing, it is probably under C:\Program Files\PHP or C:\Program Files (x86)\PHP.. - Install PHP 5.3.3 with the regular installer
- CMD: In c:\php, run go-pear, accepting defaults, run created .REG file afterwards
- pear channel-discover pear.phpunit.de
- pear install --alldeps phpunit/PHPUnit
- You'll need to edit the actual phpunit script in your PHP install directory, to change .\php.exe to the actual PHP directory.
- pear install Testing_Selenium-0.4.3
|