PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Wed May 23, 2018 5:39 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Mon Oct 27, 2003 6:15 am 
Offline
Admin
User avatar

Joined: Wed Aug 13, 2003 7:02 am
Posts: 4522
Location: York, UK
Saves typing all th letters yourself

Syntax: [ Download ] [ Hide ]
for ($i = 65; $i < 91; $i++) {

   $product_initials[($i - 65)] = chr($i);

}


Mark


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 27, 2003 6:21 am 
Offline
Her Royal Site Adminness
User avatar

Joined: Tue Apr 23, 2002 2:21 am
Posts: 5371
Location: Essex, UK
You can also do:
Syntax: [ Download ] [ Hide ]
for ($i = 'a', $j = 1; $j <= 26; $i++, $j++) {

    $letters[$j] = $i;

}

Mac


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 27, 2003 1:10 pm 
Offline
Site Admin

Joined: Thu Apr 18, 2002 3:14 pm
Posts: 1767
Location: Montreal, CA
You can also do:

Syntax: [ Download ] [ Hide ]
$letters = range('a', 'z');


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 04, 2004 11:00 am 
Offline
Forum Contributor

Joined: Fri Jun 21, 2002 5:57 pm
Posts: 466
Location: Atherstone, Warks
Jason's seems more simpler :)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 04, 2004 11:09 am 
Offline
Forum Regular

Joined: Fri Jun 20, 2003 11:03 am
Posts: 951
Location: Brisbane, Australia
Yeah it is. range() can also create an array for you from a given 'start' number till an 'end' number. Probably want to look it up in the functions reference.

It saves me a lot of time wondering it there's 27 or 25 letters in the alphabet.

doh!

-Nay


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 04, 2004 11:12 am 
Offline
Forum Contributor

Joined: Fri Jun 21, 2002 5:57 pm
Posts: 466
Location: Atherstone, Warks
27 or 25 :haha: ;)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group