And now to send my response to the entire list.

--

Scott Fletcher <mailto:[EMAIL PROTECTED]>
    on Thursday, August 21, 2003 1:12 PM said:

>     Wondering if there is any similiar function to a php
> number_format(). This time, without a period.  For example, if I get
> a '1', I would like to format it to be '01' in two digit.

Don't know about that but you could easily make your own.

<?

function numberFormatPartDeux($number, $digits)
{
        $numberCount = count($number);

        $padNeeded = ($digits-$numberCount)+1;

        $string = str_pad($number, $padNeeded, "0", STR_PAD_LEFT);

        return $string;
}


$number = 10;
$digits = 3;

echo numberFormatPartDeux($number,$digits);

?>

Or I guess I could make one for you.


Chris.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to