Archive for June, 2012

PHP round for a number to the nearest 0.5

Tuesday, June 12th, 2012

For rating, the best solution to get the nearest 0.5 precision in PHP is round($value*2) / 2 For example: 2.2 should give 2 2.3 should give 2.5 2.25 should give 2.5