0

For example, i have this array:

$arr = [
    'a' => [
        'b' => [
            'c' => 100
        ]
    ]
];

I want to somehow pass all the indexes in a string dynamically like

$str = 'a.b.c'

and use this string to access the array with the string, how can i do it?

I tried something like:

$arr[explode('.', 'a.b.c')]

But of course it didn't work.

João Hamerski
  • 461
  • 1
  • 5
  • 22

0 Answers0