Jump to content

Wondering if there is an easier way


judeddokoinu

Recommended Posts

I'm just looking to trim down my code a bit, if possible.

I was wondering if PHP itself had a function that does what this one that I wrote does:

[code]
function leadzero($number)
{
        if ($number < 10)
        {
                $new_number = '0' . $number;
                return $new_number;
        }
        else
        {
                return $number;
        }
}
[/code]
Link to comment
https://forums.phpfreaks.com/topic/9765-wondering-if-there-is-an-easier-way/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.