Creating arrays from a string

First of all I’m not sure if this is the right place to post, so I’m sorry if it’s wrong.

Now I am in a situation were I need to extract text from a ini files and put certain thins of the text into a mysql database.
so far i’ve managed to put the text into a string, but that’s it

I have to put certain things of he text into an array and that is my problem.

Here is the text structure:

[r0xx0rnation]
leader=ddd
rank=0
members=2
list=ddd,mick,
m_ddd=lord,level3
m_mick=d00d,level1

Now whhat i would like to extract in different arrays is

guildname
leader
members
characters of the members and their levels

list shows the members
and the m_ shows the character names.

I got it all into a string, i just find it difficult to seperate them.
Any ideas?

Thanks in advance!

Did you look over the parse_ini_file() function?

It does pretty much all you want. You can scan the main array using foreach(), if the value is an array, your key will be the guild name. You can than perform a foreach on the value to get the attributes. Ignore values in the main array that are not arrays.

Okay, so far I’ve managed to print either all the keys or values…

http://www.juveniles.dk/Crusade/test2.php

Maybe it’s quite obvious but i dont see it. How do I print each induvidual value?

thanks

Sponsor our Newsletter | Privacy Policy | Terms of Service