You put format type modifiers after the format type specifier, not before. Try the following:
printf('%.2F', $a)
As for the odd output, it is possible that your localization settings do this. Try running the line below and see what returns for your local one.
echo setlocale(LC_ALL, null);
Try changing your language to something else to see if the problem goes away. For instance:
setlocale(LC_ALL, 'en_CA.UTF-8');
source share