Search

Showing 7 of 1,216 result(s)

/blog/2018/04/11/laravel-5-collapsing-a-multi-dimensional-array-to-a-single-level-with-collapse#content-example-use

The examples that follow will use integers in all arrays. Assuming the following array and example: The value of $collapsedArray would then be: It is important to note that the collapse method is not recursive. This can be observed in the...

/blog/2018/04/11/laravel-5-collapsing-a-multi-dimensional-array-to-a-single-level-with-collapse#content-collapsing-collections

The collapse method will also work on collections. There is no special syntax required to use collections with the collapse method: The value of $collapsedArray would then be: Nested collections can also be collapsed: The value of collapsed array...

/blog/2018/04/11/laravel-5-conditionally-retrieving-array-values-with-where#content-example-use

In the following example, we will examine how to compare just the values of the arrays. Assume we have an array of numbers, from 0 to 100 : $numbers = range(0, 100); An array of all numbers less than or equal to 10 can be created like so:...

/blog/2018/04/11/laravel-5-conditionally-retrieving-array-values-with-where#content-global-arraywhere-helper-function

The array_where function is a shortcut to calling Arr::where . This function is declared in the global namespace.