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 csrf token and how it works?
What is a definer in mysql?
What and How possible injection in PHP and mysql?
What happens when submit button is clicked?
What is framework in php for beginners?
<?php include ("db.php"); $result = mysql_query("SELECT ques_id FROM questionbank order by ques_id limit 5 "); while($obj=mysql_fetch_array($result)) { $ad1[$obj['ques_id']]++;//Used an array and inserted the database query results into it. } $rand_keys=array_rand($ad1,1); //Did a random array function echo "First random id = ".$ad1[$rand_keys[0]]; echo "<br>Second random id = ".$ad1[$rand_keys[1]]; ?> <!--Its not working. Have any solution for this. -->
Where is session value stored php?
List some features of php that are deprecated in php7?
hey i m a trainee n jus wanted to ask that initially i was given the opportunity for .NET bt that project is abt to complete , nw i m asked to join a project of php on linux which is about to start , so wt say . is it a wise decision to join this project . will i be having job opportunities when i l complete my training after 4 months ? Plz suggest something ASAP .
How I use global variable in another page without using $_GET method?
Do while loops php?
How to find current date and time?