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 |
Which function you can use in php to open a file for reading or writing or for both?
Tell me how to strip whitespace (or other characters) from the beginning and end of a string?
How to swap two variables without using 3rd temp variable.
How to count a number of words in a string in php?
how can i disable multiple user in the same password in my website using any scripts
How to create database connection and query in php?
How do I run a php script in windows?
What is difference between php and wordpress?
how many types of inheritance is there in php? name there?
How do you end a function in python?
how can refresh current page automatically, without press any button and anchor tag.
What type of headers that PHP supports?