I have a multi array e.g
$a = array(
'key' => (
'sub_key' => 'val'
),
'dif_key' => (
'key' => (
'sub_key' => 'val'
)
)
)
The real array I have is quite large and the keys are all at different positions.
I've started to write a bunch of nested foreach and if/isset but it's not quite working and feels a bit 'wrong'. I'm fairly familiar with PHP but a bit stuck with this one.
Is there a built in function or a best practise way that I can access all values based on the key name regardless of where it is.
E.g get all values from 'sub_key' regardless of position in array.