Re: [PHP] Force zero numbers on a integer

2007-06-19 Thread Stut
[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

RE: [PHP] Force zero numbers on a integer

2007-06-19 Thread Chris Boget
> 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

Re: [PHP] Force zero numbers on a integer

2007-06-19 Thread Richard Davey
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

Re: [PHP] Force zero numbers on a integer

2007-06-19 Thread Paul Scott
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

[PHP] Force zero numbers on a integer

2007-06-19 Thread listas
Hello, 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? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, vis