Source: medium.com

Using Generators in PHP

Category: PHP

PHP 5.5 came up with an interesting function to the PHP ecosystem and that was Generators. So while using generators in PHP, we’ll see what are generators and what are different ways of using it. The structure of generators are similar to the normal functions itself.

So, generators basically loops through an data and avoids large amount of memory for that Array. Yes, generators works with an Array and while creating new array out of the loops it avoids utilizing large amount of memory.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners