|
-
Apr 23rd, 2008, 05:35 PM
#1
Thread Starter
Hyperactive Member
how to add 0's to a number
I want to add 0s to a number.
Let's say I have 5, I have to add 4 digits like this:
00005
If I have 17 I have to add 3 digits like this:
00017
-
Apr 23rd, 2008, 06:39 PM
#2
-
Apr 23rd, 2008, 06:40 PM
#3
Re: how to add 0's to a number
PHP Code:
$num = 5;
$zeros = "0000";
echo $zeros.$num;
$num = 17;
$zeros = "000";
echo $zeros.$num;
-
Apr 23rd, 2008, 09:49 PM
#4
Re: how to add 0's to a number
$r = sprintf('%05d', $number);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|