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

Answer Posted / pradeep

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

The above function will return a number of length 4.

Is This Answer Correct ?    6 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the functions used in php?

752


How cookies are transported from servers to browsers?

765


What is constructor and destructor?

759


How do you sort an array in php?

769


What is the use of count() function in php?

745


What are php magic quotes?

705


What is put method in php?

752


Why php is widely used?

739


Suppose we receive a form submitted by a post to subscribe to a newsletter. This form has only one field, an input text field named email. How would we validate whether the field is empty? Print a message "the email cannot be empty" in this case?

936


What is the difference between Session and Cookie?

820


What is the purpose of the following files having extensions: frm, myd, and myi? What these files contain?

761


Does php support multiple inheritances?

785


for image work which library?

761


Explain what is the difference between $var and $$var?

782


Php error constants and their descriptions

858