Created
December 10, 2015 03:04
-
-
Save pzzrudlf/822cef7f82d09ce1fcbb to your computer and use it in GitHub Desktop.
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
| /** | |
| * recursive function in order to convert a multiple dimensions array to a single dimension array | |
| * @param array $array | |
| * @param array $res | |
| * @return $res | |
| * @auther pzzrudlf <pzzrudlf@gmail.com> | |
| */ | |
| public function convertToSingleArray($array, &$res=[]) | |
| { | |
| foreach ($array as $key => $value) { | |
| array_push($res,$key); | |
| self::convertToSingleArray($value, $res); | |
| } | |
| return $res; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment