Created
December 5, 2014 06:24
-
-
Save ss23/2c50ee7135571822a26c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foreach ($dommy as $info) { | |
if ($first) { | |
// These are <th>'s providing information about the nations | |
foreach ($info->childNodes as $child) { | |
if ($first) { | |
$first = false; // Notice this is reused more than once, but a single var works fine | |
continue; // Skip first child, it's blank | |
} | |
if (get_class($child->firstChild) == 'DOMText') { | |
$cities[] = array('Name' => $child->textContent); | |
} else { | |
$cities[] = array('Name' => $child->textContent, 'URL' => $child->firstChild->getAttribute('href')); | |
} | |
} | |
continue; | |
} | |
// We're not on the first, so real data is here now |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment