I have this code:
$dom = new DOMDocument();
$dom->load(\'file.xml\');
$names = $dom->getElementsByTagName(\'name\');
N
Just iterate trough the elements and put them into an array:
$names_array = array();
foreach ($names as $name) {
$names_array[] = $name; // this is a DOMNode instance
// you might want to have the textContent of them like this
$names_array[] = $name->textContent;
}
This way they still will be DOMNode instances, you might want to get their textContent property.