I made xpath query to url and get a collection of elements. Now I need to get a collection of item's massives with massive for each item. In recent code I have only one massive. Help me to organize massive correctly.
//Queries by classNames
$queryItem = $xpath->query('//div[@class="catalog__item"]');
foreach ($queryItem as $goodsItem) {
$result = array (
"goodsItem" => array (
"queryName" => $xpath->query('//a[@class="goods__title"]', $goodsItem),
"queryPrice" => $xpath->query('//span[@class="price_block__cur-price"]', $goodsItem),
"queryDiscount" => $xpath->query('//span[@class="price_block__old-price"]', $goodsItem),
"queryImglink" => $xpath->query('//img[@class="catalog__item__image"]/@src', $goodsItem),
"queryDesription" => $xpath->query('//div[@class="catalog__item__text"]/p', $goodsItem)
)
);
}
var_dump($result);