Created
December 6, 2017 22:44
-
-
Save fxcosta/13b082b7893eb3dc77582a4b93ce3828 to your computer and use it in GitHub Desktop.
Convert string in "level1.level2.leveln" in assoaciative array to get value
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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