I have this problem: I read xml with PHP in Laravel, if I have only one result it doesn't print me the zero key. This creates a problem for me when I foreach the data.
$xml = Http::get(URL);
$array = XmlToArray::convert($xml);
$results = $array['farmaci'];
dd($results);
@foreach ($results as $result)
$result['name'];
@endforeach
Undefined array key "name", in case I have only one result
I would like that if I have only one result it also prints the zero key of the element therefore: