Learning PHP and MySQL

Example 11-09 Displaying a real number in money format

<?php
printf
("Please  pay  $%.2f.  ",  42.4242);
?>

Our code displays with the dollar sign and decimal correctly, as shown in Figure 11-8.

Posted by on 08/18 at 04:03 PM

Next entry: Example 11-10 Using sprintf with a variable

Previous entry: Example 11-08 Right padding with spaces

<< Back to main