significant figures adding a leading 0

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

ken-doh
New php-forum User
New php-forum User
Posts: 6
Joined: Wed Jan 08, 2003 3:27 am

significant figures adding a leading 0

Postby ken-doh » Fri May 02, 2003 5:30 am

i want to make.

$i which is 2

be 02

but 10 and 11 be like this.

any help will be great thanks

User avatar
mammal
New php-forum User
New php-forum User
Posts: 37
Joined: Wed Apr 02, 2003 1:31 am
Location: Hythe, UK

String Length

Postby mammal » Fri May 02, 2003 8:03 am

try this:

$number_length = strlen($i);
if ($number_length < 2) { $i = "0$i"; }

ken-doh
New php-forum User
New php-forum User
Posts: 6
Joined: Wed Jan 08, 2003 3:27 am

Postby ken-doh » Fri May 02, 2003 8:18 am

thanks boss


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 2 guests