I need to create a xml feed from an array with data, so im using a foreach loop to create it, but when i print_r the result, the only parts that prints out is the part before the foreach loop starts, i tested the array outside and it has data and its correctly diplayed
<PriceHeader>
<version>1.5.1</version>
</PriceHeader>';
foreach($sorted_data as $data){
'<Price>
<itemIdentifier>
<sku>'.$data["SKU"].'</sku>
</itemIdentifier>
<pricingList>
<pricing>
<currentPrice>
<value currency="USD" amount='.$data["Price"].'></value>
</currentPrice>
</pricing>
</pricingList>
</Price>';
}
'</PriceFeed>';
if i print_r that var, The only output i've got is 1.5.1, but inspecting element in chrome shows me that it creates the html structure as well, up to the point where the loop starts....
'</PriceFeed>';? I would also recommend creating the content using something like SimpleXML rather than building strings.