Showing 7 of 1,216 result(s)
The put method is used to add a new item to the collection with a given $key and $value . The put method modifies the original Collection instance and returns a reference to it.The following code example highlights the usage of the put method:...
The union method will add the $items value to a copy of the existing collection. If there are key collisions between the collection instance and the provided $items , the elements from the collection instance will be used instead. The union method...
The split method is similar to the chunk method in that it used to break a collection into a smaller number of collections. However, when using the split method, you specify the number of groups you would like the collection split into and it will...
The average method is simply an alias of the avg method, and can be used in exactly the same way.
The avg method is a useful method for calculating the average of all items in the collection. The avg method defines an optional $key parameter, which can be used to specify what property of the collection should be averaged. If no key is...
In mathematics, the median value is the numeric value that separates the higher half a data sample from the lower half; the median value does not necessarily exist within the data set itself. The median method can be used to get the median value...
The sum is a simple method that returns the sum of all items in a collection. It also defines a $callback parameter which can be used to tell the sum method which values of the collection should be added together. If no items are in the...