Skip to content

Commit b4ae03f

Browse files
authored
Add random key doc (#70)
1 parent 33e6325 commit b4ae03f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/formatters/numbers-and-strings.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,16 @@ echo $faker->randomElement(['a', 'b', 'c', 'd', 'e']);
114114
// 'c'
115115
```
116116

117+
## `randomKey`
118+
119+
Returns a random key from the given array.
120+
121+
```php
122+
echo $faker->randomKey(['a' => 1, 'b' => 2, 'c' => 3]);
123+
124+
// 'b'
125+
```
126+
117127
## `shuffle`
118128

119129
Returns a shuffled version of either an array or string.

0 commit comments

Comments
 (0)