Web and Technology Support
Html, JAVA,DOTNET,Javascript, PHP, and JQuery Scripts and its issues with solutions
Wednesday, 25 June 2014
PHP number format 4 digits [duplicate]
Method I
echo str_pad( "3", 4, "0", STR_PAD_LEFT );
Input $s_number = "3"; Output: 0003
Method II
$s_number = '12';
printf("%04d", $s_number);
Input $s_number = "12"; Output: 0012
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment