Palzin Track
Get 15% off with code PTRACKSIGNUP15 

Laravel Diary Logo

Laravel Collection Public API: shift

The shift method in PHP's Illuminate\Support\Collection class is used to remove the first item from the collection and return its value. It modifies the original collection instance. In the provided example, the shift method is used to remove the first item 'first' from the collection, resulting in the collection to only contain 'second' and 'third'.