Array help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

I have a login/password file with these kind of  values:
user1:pass1
user2:pass2
cat:dog
love:hate

I have  opened the file and put it into an array with this code:
(thanks to richard lynch from this list for idea and code snippets)

$file =  file_get_contents('a.htpasswd');
preg_match_all('/(.*):(.*)$/msU', $file,  $htpassd);

but how do I get it into this format  :

$users['username'] = 'password'

without using a loop? I was  thinking something like array_flip or array_splice??
(The reason I dont want to use a loop (for,while) is there can be thousands of user:pass combos in the files and thousands of logins and attempted logins a day)

Suggestions/comments/links too are most welcome.

Cheers!
R


------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
 
---------------------------------
Access over 1 million songs - Yahoo! Music Unlimited.

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux