What is the difference between mathematical rounding and kaufmännisches (commercial) rounding in PHP?

Mathematical rounding in PHP involves rounding a number to the nearest integer, with ties rounding away from zero. Kaufmännisches (commercial) rounding, on the other hand, involves rounding a number to the nearest integer, with ties rounding towards the nearest even number. To implement commercial rounding in PHP, you can use the round() function with the PHP_ROUND_HALF_EVEN constant.

$number = 10.5;
$rounded = round($number, 0, PHP_ROUND_HALF_EVEN);
echo $rounded; // Output: 10

$number = 11.5;
$rounded = round($number, 0, PHP_ROUND_HALF_EVEN);
echo $rounded; // Output: 12