number formatting

    Date: 02/06/07 (Code WTF)    Keywords: no keywords

    найдено в пхп-коде одного сайтика %)

    function append_zeros($number, $length) {
           while (strlen($number) < $length)
               $number = "0$number";
           return $number;
       }


    о sprintf("%0nd", $number) видимо не слышали )

    и оттуда же....
    function format_money($value) {
           $negative = "";
           if ($value < 0)
               $negative = "-";
           return "$negative$".number_format(abs($value), 2);
       }

    Source: http://community.livejournal.com/code_wtf/67351.html

« FOX Toolkit || unboxing »


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