Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


How do you format and output a number with leading zero's?

Answers were Sorted based on User's Feedback



How do you format and output a number with leading zero's?..

Answer / mahesh

$d=450;
$d = str_pad($d,6,0,0);
echo $d;
OUT PUT
000450

Is This Answer Correct ?    8 Yes 0 No

How do you format and output a number with leading zero's?..

Answer / pradeep

Using sprinf("%04d",$num);

The above function will return a number of length 4.

Is This Answer Correct ?    6 Yes 1 No

How do you format and output a number with leading zero's?..

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

Post New Answer



More PHP Interview Questions

What is meant by pear in php? What is the purpose of it?

0 Answers  


What are the advantages of object-oriented programming in php?

0 Answers  


Is server side a session?

0 Answers  


How long is a php session valid?

0 Answers  


Which is the correct way to check if a session has already been started ?

0 Answers  






When do sessions end?

0 Answers  


Why do we use javascript in php?

0 Answers  


Tell me what is the default session time in php?

0 Answers  


Explain do you use composer? If yes, what benefits have you found in it?

0 Answers  


Can we override static method?

0 Answers  


How to create an array of a group of items inside an html form?

0 Answers  


What are the steps for the payment gateway processing?

0 Answers  






Categories