I am running a foreach loop that goes through a standard array of string values. These values are used to search xml nodes with simpleXML and get the matching node for processing.
For the most part my loop is a success. Only the first and last nodes being searched from the array are not getting found. I know that it is strictly the first and last values of the array for that by trading values in the array will cause the value that wasnt last or first but found before is now not being found when put first or last in the array.
Here is my code:
PHP Code:
$inputArr = explode(',',$requiredNode);
$customerNode = $apiXML->customer;
foreach($inputArr as $input)
{
echo 'input: '.$input.'<br />';
$childNode = $customerNode->$input;
echo 'child: '.$childNode.'<br />';
$nodeArr[] = array($childNode->getName(), $childNode, $childNode['value'], $childNode['readonly']);
}
$requiredNode - node in xml that has string of multiple values separated by a comma.
$input - is getting all the info I expect when running an echo
$childNode - works fine except the first and last index in the loop, it returns empty in those cases (the values being search are in the xml file, I made sure of that and it can be found when not in the first or last index of $inputArr)
Appreciate any help with this