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 is the best method to fetch the data from mysql? 1.mysql_fetch_array() 2.mysql_fetch_object() 3.mysql_fetch_row() 4.mysql_fetch_assoc()
How send email using php?
What are the different types of PHP arrays?
How can I find the width and height of an image resource?
2 Answers Rushmore Consultancy,
Is php deprecated?
What is $_ env in php?
Explain the difference between session and cookies in php?
Is php dying 2018?
Can php run without apache?
What is env in laravel?
Which function can be used to delete a file?
What is mvc php?