-1

I just want to return an array value of an array by knowing it's position but not the key.

array(
    [807]=> array(
       [0] => "test",
       [1] => "test2"
    ),
    [808]=> array(
       [0] => "test",
       [1] => "test2"
    ),
    [809]=> array(
       [0] => "test",
       [1] => "test2"
    ),
    [810]=> array(
       [0] => "test",
       [1] => "test2"
    )
)

Let's say i've got the exact positions i want to check: How do i access array[2] to return array with key 809?

Note: array keys wont be all the time succesive.

Thank you

OzZie
  • 523
  • 9
  • 21

1 Answers1

1

Nvm! I found a way by doing this:

$original_keys = array_keys($original_array);
$search_KEY = $original_keys[$key];

Where $key is known as position of the original array. This would return me the exact array key-value pair by using $original_array[$search_KEY]

OzZie
  • 523
  • 9
  • 21