significant figures adding a leading 0

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
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

Post by 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

Post by 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

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

thanks boss

Post Reply

Who is online

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