Is it more efficient to format numbers with 2 decimal places using PHP or MySQL functions?

When formatting numbers with 2 decimal places, it is generally more efficient to do so using PHP functions rather than MySQL functions. This is because PHP has built-in functions like number_format() that are specifically designed for formatting numbers, while MySQL functions like FORMAT() can be less flexible and may require additional queries to achieve the desired result.

// PHP code snippet to format a number with 2 decimal places
$number = 123.456789;
$formatted_number = number_format($number, 2);
echo $formatted_number; // Output: 123.46