Access non-numerically indexed array by their order number
Hi all,
For example if I have
$array = array(
'assd' => 21,
's9aso' => 1267,
2 => 129
);
And I need to access 2nd element in the array, not the element with
the key 2, but 's9aso' => 1267.
I know array_splice works that way, for example array_slice($array, 1)
will return two last elements, ie starting at 2nd element (id=1).
Is there a way to access an array that way, by some internal id number
which always starts at 0 etc? I could use array_keys to get
array(
0 => 'assd',
1 => 's9aso',
2 => 2
)
But other than that?
Thanks!
|