i have text with many lines like this:
(item (Index Value) (Name Value)(Name2 Value2)(Name3 Value3) (Speciality (Name-a value-a) (Name-b value-b))
Real example:
(item(name 256)(Index 1)(Image "Wea001")(Action 1 1)(class weapon sword)(code 1 1 1 1)(country 2)(level 1)(wear 1) (limit Knight 1)(range 16)(buy 4)(sell 1)(endurance 4)(specialty(aspeed 700)(Attack 3 10)(hit 15)))
Now i want to save them in array $Items[$Index] -index value is the (Index XX) in the line-
and in each value new array contain the values in this, for example (using the real line)
$Items[1]{
$Name => 256,
$Image => 'Wea001',
$Action=> '1 1',
$class => 'weapon sword',
...etc
}
i already saved them in the master array using the explode, but using default values 0,1,2,3,..etc not the Index of the line
$items = explode('<br />', $inititemcontent);
for($i = 0; $i < count($items); $i++){
echo "$items[$i] <br />";
}
PS: the index value never repeated, there can never be 2 lines with the same index PPS: not usually all the small tags (Name Value) exist, some times all of them, some times only some.