Skip to content

Commit a5e2724

Browse files
committed
Add Arr::dot method
1 parent 4aa79f6 commit a5e2724

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,4 +252,8 @@ A helper library for working with arrays.
252252

253253
##### `static flatten(array $array, string $separator = '.', string $prepend = '') : array`
254254

255-
Flatten an associative array using a custom separator.
255+
Flatten an associative array using a custom separator.
256+
257+
##### `static dot(array $array) : array`
258+
259+
Flatten an associative array using a dot (.) separator.

src/Arr.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,15 @@ public static function flatten(array $array, string $separator = '.', string $pr
3232

3333
return $flatArray;
3434
}
35+
36+
/**
37+
* Flatten an associative array using a dot (.) separator.
38+
*
39+
* @param array $array
40+
* @return array
41+
*/
42+
public static function dot(array $array): array
43+
{
44+
return self::flatten($array);
45+
}
3546
}

0 commit comments

Comments
 (0)