Skip to content

Instantly share code, notes, and snippets.

@fxcosta
Created December 6, 2017 22:44
Show Gist options
  • Save fxcosta/13b082b7893eb3dc77582a4b93ce3828 to your computer and use it in GitHub Desktop.
Save fxcosta/13b082b7893eb3dc77582a4b93ce3828 to your computer and use it in GitHub Desktop.
Convert string in "level1.level2.leveln" in assoaciative array to get value
function printMultiArray($originalArray, $string)
{
$temp = $originalArray;
$nameArray = explode('.', $string);
foreach($nameArray as $string) {
$temp = $temp[$name];
}
return $temp;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment