I wanted to take the fields such as School Type, Name, Location, Details, Degreemjor, Education details, Start and End Date
How can i do this using the foreach loop
I'm an idiot, it didn't click that that was XML. Okay, so your array appears to be an array of schools/institutions from a resume, correct? Just follow the XML hierarchy to reach each node that you care about.
foreach ($nodes as $node) {
echo "Type: " . $node->attributes()['SchoolType'] . "\n";
echo "Name: " . $node->School->SchoolName . "\n";
echo "Location: " . $node->SchoolLocation . "\n";
echo "Degree name: " . $node->Degree->DegreeName . "\n";
// etc
}