I have an array $myarray like:
Array (
[45] => stdClass Object (
[id] => 45
[response_id] => 2
[question_id] => 1
[choice_id] => 2
)
[46] => stdClass Object (
[id] => 46
[response_id] => 2
[question_id] => 2
[choice_id] => 4
)
...
)
How can I reference the positions of this array? For instance getting the first, second, . . . position of the array.
The only way that seems to work is if I explicitly say
$myarray[45]->choice_id
But I don't always know the numbers and I want to reference the positions. Is there a way to reference the first position as:
$myarray[0]->choice_id
Thanks
array_valuesto reset the keys with the usual zero indexed sequence.