@@ -68,6 +68,23 @@ The `array_first` method returns the first element of an array passing a given t
68
68
A default value may also be passed as the third parameter:
69
69
70
70
$value = array_first($array, $callback, $default);
71
+
72
+ ### array_last
73
+
74
+ The ` array_last ` method returns the last element of an array passing a given truth test.
75
+
76
+ $array = array(350, 400, 500, 300, 200, 100);
77
+
78
+ $value = array_last($array, function($key, $value)
79
+ {
80
+ return $value > 350;
81
+ });
82
+
83
+ // 500
84
+
85
+ A default value may also be passed as the third parameter:
86
+
87
+ $value = array_last($array, $callback, $default);
71
88
72
89
### array_flatten
73
90
@@ -142,6 +159,19 @@ The `array_sort` method sorts the array by the results of the given Closure.
142
159
{
143
160
return $value['name'];
144
161
}));
162
+
163
+ ### array_where
164
+
165
+ Filter the array using the given Closure.
166
+
167
+ $array = array(100, '200', 300, '400', 500);
168
+
169
+ $array = array_where($array, function($key, $value)
170
+ {
171
+ return is_string($value);
172
+ });
173
+
174
+ // Array ( [1] => 200 [3] => 400 )
145
175
146
176
### head
147
177
@@ -212,6 +242,18 @@ Convert the given string to `snake_case`.
212
242
$snake = snake_case('fooBar');
213
243
214
244
// foo_bar
245
+
246
+ ### str_limit
247
+
248
+ Limit the number of characters in a string.
249
+
250
+ str_limit($value, $limit = 100, $end = '...')
251
+
252
+ Example:
253
+
254
+ $value = str_limit('The PHP framework for web artisans.', 7);
255
+
256
+ // The PHP...
215
257
216
258
### starts_with
217
259
0 commit comments