How do you format and output a number with leading zero's?
Answers were Sorted based on User's Feedback
Answer / mahesh
$d=450;
$d = str_pad($d,6,0,0);
echo $d;
OUT PUT
000450
| Is This Answer Correct ? | 8 Yes | 0 No |
Answer / pradeep
Using sprinf("%04d",$num);
The above function will return a number of length 4.
| Is This Answer Correct ? | 6 Yes | 1 No |
Answer / mahidhar
syntax:number_format("number","decimal places","string
seperator","string thousands seperator");
Example:number_format('1000',2,'.','')
| Is This Answer Correct ? | 6 Yes | 6 No |
What is the difference between die () and exit () in php?
What is the use of anonymous function in php?
Name the Functions in IMAP, POP3 AND LDAP?
Are there regular expressions in php?
How does csrf token work?
how php works with oracle?
How is it possible to cast types in php?
What are php data types?
Explain how is it possible to cast types in php?
What is super keyword in c++?
List data types in PHP?
For image work which library is used in php?