I have this array:
$array = array(
array('id' => 'test1',
'url' => 'test1url'
),
array('id' => 'test2',
'url' => 'test2url'
)
);
How to access “test1url” without knowing the parent key but knowing the corresponding ID (test1)?
If I knew the parent key I could simply access it like this:
$array[0]['url'];
So what would be the simplest/fastest/quickest/easiest way to access this value?
Thanks!
There is no solution better than looping all values in this case.
You can create a function like this:
and call it:
or create another representation of your data, but if you cannot do it, the best solution is this loop.