I have pasted the code below... imagine it is set up with $new_node being a parent node with 5 children including the "title", "order", "month", "day", "year" - the order is the amalgamation of year, month, then day into something like 20021208 so that I can order the entries easily, but this has already been done in the xml, the $stop_value = 1 and the $ending_value is equal to a loop already going on that is looping through these parent nodes. (The xml is a set of short news stories, <stories><story><title>whatever</title>...</story><story>...</story></stories> if that makes sense...
so the function loops through the children of the parent node, each time encountering a node with the name "order" it places the value into the array "matching_array" or at least it should...
Interestingly, when I run this script... it shows the countdown till the var_dump like it should...
1,5
1,4
1,3
1,2
1,1
but then it prints out the var_dump($matching_array); and it only has 1 value in it! ?
any ideas what is going wrong? Why the $matching_array[] isnt collecting the ->get_content(); from each "order" node?
I have pasted the code below.
function get_dates($new_node, $stop_value, $ending_value)
{
$new_node_kids = $new_node->children();
for($a=0; $a<sizeof($new_node_kids); $a++)
{
if ($new_node_kids[$a]->type == XML_ELEMENT_NODE)
{
if ($new_node_kids[$a]->name() == "order")
{
$matching_array[] = $new_node_kids[$a]->get_content();
echo $stop_value . "." . $ending_value . "<br>";
if ($stop_value == $ending_value){ echo var_dump($matching_value);}
}
}
}
}