The simple answer is: foreach in Blade works just like regular PHP foreach . You should be able to do something like:
@foreach ($nodes as $node) <li>{{ $node->url }}</li> @endforeach
If you need access to the array key value for each node:
@foreach ($nodes as $key => $node) <li>{{ $key }}: {{ $node->url }}</li> @endforeach
However, I think the problem may not be with the Blade syntax, but with the way you created your input variables. Given the way you create $oReturn in the code above, it will not have the properties you expect to expect. To illustrate here, a simplified version of what you are creating:
// initialize your return variable $oReturn = new stdClass(); // create a dummy array <sdata:x> nodes, // to simulate $nodes = $c->children('sdata', true); $node = new SimpleXMLElement('<sdata:x/>'); $nodes = [ $node, $node, $node ]; // simulate adding nodes to the array of entries $oReturn->entry[] = [ $node, $node, $node ]; // print out the resulting structure print_r( compact( 'oReturn' ) );
will return:
Array( [oReturn] => stdClass Object ( [entry] => Array ( [0] => Array ( [0] => SimpleXMLElement Object() [1] => SimpleXMLElement Object() [2] => SimpleXMLElement Object() ) ) ) )
So, when you do @foreach ($oReturn as $node) , the value of $node will be an entry[] array that has one element, which is an array of nodes. From your input it is not clear that these nodes even have url elements. If you want to iterate over nodes, you need to do something like:
@foreach ($oReturn->entry[0] as $node) <li>{{ $node->url }}</li> @endforeach
It makes sense? I think you need to rethink your creation of
$oReturn .
Update
The following is the feedback and output from your print_r statement, which should work:
@foreach ($oReturn->entry as $node) <li>{{ (string) $node->url }}</li> @endforeach
(string) prints the result of $node->url to a string. Otherwise, PHP may consider it as a kind of object. SimpleXMLElement may be strange.