how to get an array of xml with php?

Complex

New Member
how to get an array of xml with php in this format, of an external file\[code\]$locations = array( (Bondi Beach, -33.890542, 151.274856, 4), (Coogee Beach, -33.923036, 151.259052, 5), (Cronulla Beach', -34.028249, 151.157507, 3));//this is my file php $dom = new DOMDocument(); $dom->load('school.xml'); $students = $dom->getElementsByTagName('student'); $i = 0; foreach ($students as $student) { $locations = $students->item(0)->nodeValue; echo $locations; $i++; }\[/code\]when I run this code returns the following result:
Bondi Beach -33.890542 151.274856 4 Coogee Beach -33.923036 151.259052 5 Cronulla Beach -34.028249 151.157507 3
What do I have to change so that It return an array with the following format?:this is my array school.xml \[code\]<school><student><name>Bondi Beanch</name><latitude>-33.890542</latitude><longitude>151.274856</longitude><id>4</id></student><student><name>Coogee Beach</name><latitude>-33.923036</latitude><longitude>151.259052</longitude><id>5</id></student><student><name>Cronulla Beach</name><latitude>-34.028249</latitude><longitude>151.157507</longitude><id>3</id></student></school>\[/code\]
 
Back
Top