Zend PHP 5.3 Certification Exam


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
  • Question 29/31

    One way to format currencies in PHP is to use the built-in money_format() function. Before using it you must set the locale for the type of currency you're trying to format.

    What is the output of the following PHP script? The currency name for en_US is USD and uses $ as the currency symbol. Additionally, there are 100 cents to the dollar.

    
    <?php
        setlocale(LC_MONETARY'en_US');
    
        $amt 100;
    
        echo money_format('%.2n'$amt);
    ?>