Hello forums. Supppose i had following format in a string [PHP]$string = '<tag value="1">Name1</tag> <tag value="2">Name2</tag> : : <tag value="n">Namen</tag>';[/PHP]
I would like to collect those values and names in an array as [PHP]$array['name'] = array('Name1', 'Name2', .., 'Namen'); $array['value'] = array('1', '2', .., 'n');[/PHP]
Any suggestions and hints are warmly welcome.
sandy103
6:55 am on Nov 26, 2007 (gmt 0)
I can suggest two methods for this. Either you can use the regular expression and find the name between the open tag and the close tag and also find the find attribute of the tag to get the value. Another option can be to use any xml parser logic.