@@ 94-121 (lines=28) @@ | ||
91 | } |
|
92 | } |
|
93 | ||
94 | if ( ! function_exists('array_dot')) |
|
95 | { |
|
96 | /** |
|
97 | * Flatten a multi-dimensional associative array with dots. |
|
98 | * |
|
99 | * @param array $array |
|
100 | * @param string $prepend |
|
101 | * @return array |
|
102 | */ |
|
103 | function array_dot($array, $prepend = '') |
|
104 | { |
|
105 | $results = array(); |
|
106 | ||
107 | foreach ($array as $key => $value) |
|
108 | { |
|
109 | if (is_array($value)) |
|
110 | { |
|
111 | $results = array_merge($results, dot($value, $prepend.$key.'.')); |
|
112 | } |
|
113 | else |
|
114 | { |
|
115 | $results[$prepend.$key] = $value; |
|
116 | } |
|
117 | } |
|
118 | ||
119 | return $results; |
|
120 | } |
|
121 | } |
|
122 | ||
123 | if ( ! function_exists('array_except')) |
|
124 | { |
|
@@ 1016-1043 (lines=28) @@ | ||
1013 | } |
|
1014 | } |
|
1015 | ||
1016 | if ( ! function_exists('dot')) |
|
1017 | { |
|
1018 | /** |
|
1019 | * Flatten a multi-dimensional associative array with dots. |
|
1020 | * |
|
1021 | * @param array $array |
|
1022 | * @param string $prepend |
|
1023 | * @return array |
|
1024 | */ |
|
1025 | function dot($array, $prepend = '') |
|
1026 | { |
|
1027 | $results = array(); |
|
1028 | ||
1029 | foreach ($array as $key => $value) |
|
1030 | { |
|
1031 | if (is_array($value)) |
|
1032 | { |
|
1033 | $results = array_merge($results, dot($value, $prepend.$key.'.')); |
|
1034 | } |
|
1035 | else |
|
1036 | { |
|
1037 | $results[$prepend.$key] = $value; |
|
1038 | } |
|
1039 | } |
|
1040 | ||
1041 | return $results; |
|
1042 | } |
|
1043 | } |
|
1044 | ||
1045 | if ( ! function_exists('first')) |
|
1046 | { |