- substr: documentation ( source)
- round: documentation ( source)
- strrchr: documentation ( source)
- number_format: documentation ( source)
<?php
echo number_format(round(3.2550, 2), strlen(substr(strrchr(3.2550, "."), 1)), ',', '.');
echo PHP_EOL;
echo number_format(round(3.4000, 2), strlen(substr(strrchr(3.4000, "."), 1)), ',', '.');