Я пытаюсь заставить работать следующий код.
foreach ($uniqueItems as $key => $value) {
$output = "{$value->properties->property[10]->value}";
echo $output;
}
В браузере вижу 24.99
Выше код дает мне правильный вывод. Но мне нужен вывод $ за пределами этого foreach. Я пробую следующее
$output = "{\$value->properties->property[10]->value}";
foreach ($uniqueItems as $key => $value) {
echo $output;
}
В браузере я вижу {$ value-> properties-> property [10] -> value}
Это print_r ($ uniqueItems [$ key]);
SimpleXMLElement Object
(
[name] => Donnay joggingbroek zwart unisex
[properties] => SimpleXMLElement Object
(
[property] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => deliveryTime
)
[value] => Voor 16.00 uur besteld, morgen in huis!
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => brand
)
[value] => Donnay
)
[2] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => size
)
[value] => SimpleXMLElement Object
(
)
)
[3] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => color
)
[value] => Zwart
)
[4] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => EAN
)
[value] => SimpleXMLElement Object
(
)
)
[5] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => categoryPath
)
[value] => Tenniskleding/Tenniskleding dames
)
[6] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => deliveryCosts
)
[value] => 4.95
)
[7] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => discount
)
[value] => 5.00
)
[8] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => subcategories
)
[value] => Tenniskleding dames
)
[9] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => SKU
)
[value] => 489000-TL-020
)
[10] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => fromPrice
)
[value] => 24.99
)
))
Как получить правильный вывод?