change type

General discussions related to php

Moderators: egami, macek, gesf

Post Reply
User avatar
frogrocker
New php-forum User
New php-forum User
Posts: 97
Joined: Mon Jul 07, 2003 10:30 pm
Location: Manchester

Sun Jul 13, 2003 10:58 am

is it possible to change an interger to have a certain amount of numbers in it

e.g
can i change 7 to 07
keep 12 as 12
change 5 to 05
etc.

TIA
"Don't look at the trombones - it only encourages them..."

willplatts@gmail.com

User avatar
bezmond
Moderator
Moderator
Posts: 312
Joined: Sat Apr 05, 2003 4:33 am
Location: Mansfield, UK
Contact:

Sun Jul 13, 2003 2:01 pm


User avatar
swirlee
Moderator
Moderator
Posts: 2257
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Sun Jul 13, 2003 6:55 pm

The "right" way to do this is to use sprintf() or str_pad(). They're both pretty straight-forward, just read the docs.
Image

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests