[EMAIL PROTECTED] wrote:
I have a integer that is submitted by the user and i need it to always
contain 5 digits.
If the user submitted 45, i need it to be 00045.
If the user submitted 4595, i need it to be 04595.
How can i do this?
$val = str_pad(intval($val), 5, '0', STR_PAD_LEFT);
-Stut
> I have a integer that is submitted by the user and
> i need it to always contain 5 digits.
> If the user submitted 45, i need it to be 00045.
> If the user submitted 4595, i need it to be 04595.
> How can i do this?
Check out printf();
http://us.php.net/manual/en/function.printf.php
thnx,
Chr
Hi,
Tuesday, June 19, 2007, 5:17:29 PM, you wrote:
> I have a integer that is submitted by the user and i need it to always
> contain 5 digits.
> If the user submitted 45, i need it to be 00045.
> If the user submitted 4595, i need it to be 04595.
> How can i do this?
Given PHPs type switchin
On Tue, 2007-06-19 at 13:17 -0300, [EMAIL PROTECTED] wrote:
> I have a integer that is submitted by the user and i need it to always
> contain 5 digits.
>
str_pad($userSubmittedNumber, 5, 0, 0);
--Paul
All Email originating from UWC is covered by disclaimer
http://www.uwc.ac.za/portal/uwc2006
4 matches
Mail list logo