<?php
$strQueryText = "/path/to/xml/file.xml";
$objXML = new CDataXML();
$objXML->Load($strQueryText);
$arData = $objXML->GetArray();
$arResult = array();
foreach ($arData['items']['#']['item'] as $arValue) {
$ar = array();
foreach ($arValue['#'] as $sKey => $sVal) {
$ar[$sKey] = $sVal[0]['#'];
}
$arResult[] = $ar;
}
$j = 0;
$sk = array();
foreach ($arResult as $qwe => $new) {
$id[$j]['guid_item'] = $new['guid_item'];
$i = 0;
while (count($new['related_folders']['guid_folder']) > $i) {
$id[$j]['guid_folder'][$i] = $new['related_folders']['guid_folder'][$i]['#'];
$i++;
}
$j++;
}
$col = count($id);
for ($i = 0; $i <= $col; $i++) {
$res = CIBlockElement::GetList(array(), array('IBLOCK_ID' => 10, 'XML_ID' => $id[$i]['guid_item'], 'SITE_ID' => "s1"));
$item = $res->Fetch();
echo "item_id: " . $item["ID"] . "<br>";
$k = 0;
$myArr = $id[$i]['guid_folder']; // не выводит
//$myArr = array('8f50834b-7f76-42c1-a019-3b3b29d93c40','37728a3a-0a97-4f16-a272-f0a8d7842d99'); // выводит
foreach ($myArr as $dope => $now) {
$fSections = CIBlockSection::GetList(
false, Array("IBLOCK_ID" => 10, "XML_ID" => $myArr[$k]), false, Array("ID"), false
);
while ($flSections = $res->getNext()) {
echo "folder_id: " . $flSections['ID'] . "<br>";
}
$k++;
}
}
Если указать массив, созданный вручную, то работает корректно:
//$myArr = $id[$i]['guid_folder'];
$myArr = array('8f50834b-7f76-42c1-a019-3b3b29d93c40','37728a3a-0a97-4f16-a272-f0a8d7842d99');
Иначе $flSections пустой (((
При print_r массивы имеют идентичный формат. Подскажите что я делаю не так?