@@ -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
@@ -144,6 +161,19 @@ The `array_sort` method sorts the array by the results of the given Closure.
144
161
{
145
162
return $value['name'];
146
163
}));
164
+
165
+ ### array_where
166
+
167
+ Filter the array using the given Closure.
168
+
169
+ $array = array(100, '200', 300, '400', 500);
170
+
171
+ $array = array_where($array, function($key, $value)
172
+ {
173
+ return is_string($value);
174
+ });
175
+
176
+ // Array ( [1] => 200 [3] => 400 )
147
177
148
178
### head
149
179
@@ -216,6 +246,18 @@ Convert the given string to `snake_case`.
216
246
$snake = snake_case('fooBar');
217
247
218
248
// foo_bar
249
+
250
+ ### str_limit
251
+
252
+ Limit the number of characters in a string.
253
+
254
+ str_limit($value, $limit = 100, $end = '...')
255
+
256
+ Example:
257
+
258
+ $value = str_limit('The PHP framework for web artisans.', 7);
259
+
260
+ // The PHP...
219
261
220
262
### starts_with
221
263
0 commit comments