How to use a string as an array index path to retrieve a value?

A Bit later, but… hope helps someone:

// $pathStr = "an:string:with:many:keys:as:path";
$paths = explode(":", $pathStr); 
$itens = $myArray;
foreach($paths as $ndx){
    $itens = $itens[$ndx];
}

Now itens is the part of the array you wanted to.

[]’s

Labs

Leave a Comment