I have a method that does cool magical stuff and then returns my results in the form of an array.
So for instance
public function somemethod()
{
some stuff that builds an array
return $stuff;
}
If you do a
$s = stuff();
print_r($s->somemethod());
You get something like
array('a' => 'hi', 'b' => 'hello', 'c' => 'konnichiwa')
How can I access each array element?
$s->somemethod()->a?
$s->somemethod()['a'] ?
Use foreach:
or 1 by 1: