Working with numbers

    Date: 08/17/05 (PHP Community)    Keywords: php, google

    I've got some code here:

    $number = array(1,1.5,1.75);
    for ($i = 0; $i <= 2; $i++) {
       echo "\$".$number[$i]." ";
    };
    ?>

    which returns "$1 $1.5 $1.75". However, I'd really like it to return "$1.00 $1.50 $1.75" instead. Is there some kind of PHP round function that has it return the trailing zeros in a decimal? I tried searching google, but I wasn't really so sure what to look for. Sorry if this question is way too basic.

    Source: http://www.livejournal.com/community/php/337119.html

« Ressource id #8 || detecting contents of... »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home