Reputation: 4142
Morning!
It's quite early in the morning, so I think the answer of my question will be obvious, but I just can't seem to figure it out.
This is the situation: I have a C# application which communicaties via a WCF webservice with my PHP project. Now, a function in my C# application generates something like this:
stdClass Object ( [GetSpecsResult] => stdClass Object (
[string] => Array (
[0] =>
[1] => Test
[2] => Test
[3] => 14-8-2013 10:08:53
[4] => 14-8-2013 10:08:52
[5] =>
[6] => ) ) )
Basically, what I want is to get the values to print nicely in my PHP project. I could do a foreach within a foreach, this works also, but I'm pretty sure that's not the correct way.
Can someone help me out?
Upvotes: 0
Views: 452
Reputation: 2296
The simple way to do this is actually what you say, with a foreach on the array. You do not need a double foreach I think, because you likely only get one stdClass back for the 'GetSpecsResult'.
The clean nice/tidy way is to do this using an iterator on the array but that assumes you: a) have a object model and b) implemented the iterator.
Just go with one/two foreaches, it is the right thing to do!
Upvotes: 1