change type

General discussions related to php

Moderators: macek, egami, gesf

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

change type

Postby frogrocker » 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

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

Postby bezmond » Sun Jul 13, 2003 2:01 pm


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

Postby swirlee » 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.


Return to “PHP General”

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest

cron