I am fetching keywords from an SQL table which returns a simpleXML string that looks like the following:
<ranks>
<tags>
<tag>Alabama</tag>
<tagID>1</tagID>
</tags>
<tags>
<tag>Alaska</tag>
<tagID>2</tagID>
</tags>
<tags>
<tag>Arizona</tag>
<tagID>3</tagID>
</tags>
</ranks>
Now I would need this in the form of an array that I can store as a variable.
Can someone tell me how to achieve this ? I am pretty new to arrays and did not know a way to start here as there are always two values for each tag, i.e. the tag name and the tagID whereas I only need an array with the tag names. Ideally the result should look something like the following:
$tags = ['Alabama', 'Alaska', 'Arizona'];