Showing 7 of 1,216 result(s)
The following example demonstrates the forPage method: The $fifthPage variable will now contain an instance of the Collection class and will have a value similar to the following output:
The chunk method can be used to achieve similar results. The following code sample will use the same collection from the previous example, and chunk it into smaller collections each containing two items. The $pages variable is also an instance of...
The following calls to the sortBy and sortByDesc methods are functionally equivalent:
Like the sortBy method, the sortByDesc method can also be used with higher order messages. We will adjust the example explored in the sortBy section: The PeripheralDevice Class: sortByDesc with Higher Order Messages: After the above code has...
The following collection of imaginary users will be used when demonstrating the features of the sortBy method: It is possible to sort the $collection by name like so: The $sorted variable would now be an instance of Collection and the items would...
The $options parameter allows developers to change the sorting behavior of the sortBy method. The accepted options are the same options that are defined for PHP's sort function. The following collection instance will be used throughout this...
The following tables will show how the different sorting flags change the sorting of the previously made $collection . Each sorting flag has its own section, which will follow this section. The first table shows the key and its associated value...
The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.