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

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners