Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

significant figures adding a leading 0

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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
ken-doh
New php-forum User
New php-forum User
 
Posts: 6
Joined: Wed Jan 08, 2003 3:27 am

String Length

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

try this:

$number_length = strlen($i);
if ($number_length < 2) { $i = "0$i"; }
User avatar
mammal
New php-forum User
New php-forum User
 
Posts: 37
Joined: Wed Apr 02, 2003 1:31 am
Location: Hythe, UK

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

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


Return to PHP coding => General

Who is online

Users browsing this forum: Google Feedfetcher and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.