Array question
Moderator: General Moderators
Array question
I'm trying to make a password gen script for personal use and I'm just wondering about a clean way of using an array.
abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ
1234567890
!@#$%^&*()_+-=[]{};':",./?
Do i pretty much have to store all this in an array the generic way ($COLORS= array('zero', 'one', 'two', 'three') or can I use regular expressions [a-z] but then how would that work calling array ID's etc....
abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ
1234567890
!@#$%^&*()_+-=[]{};':",./?
Do i pretty much have to store all this in an array the generic way ($COLORS= array('zero', 'one', 'two', 'three') or can I use regular expressions [a-z] but then how would that work calling array ID's etc....
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: Array question
Can you clarify this question? What other way is there to store data in an array?kingdbag wrote:Do i pretty much have to store all this in an array the generic way ($COLORS= array('zero', 'one', 'two', 'three') or can I use regular expressions [a-z] but then how would that work calling array ID's etc....
Everah | Please use
or this
I guess what im trying to say is if I have an array with something in common like A-Z do I really have to do
or can I do something like
I tried finding info on it and I kept coming up with the generic ones....
Everah | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Well the 2 most common I would think are these (or other with similar formatting):Code: Select all
$Array = array();
$Array[]="http://www.yahoo.com/";
$Array[]="http://www.internet.com";
$Array[]="http://www.google.com";
$Array[]="http://www.cnn.com/";
$Array[]="http://www.php.net/";Code: Select all
$Array=array("http://www.yahoo.com", "http://www.internet.com", "http://www.google.com", "http://www.cnn.com/","http://www.php.net/");Code: Select all
$Array=array(A,B,C,D,etc)Code: Select all
$Array=array([A-Z]);Everah | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Code: Select all
$array = range('A', 'Z');