PHP7 Generator new features

preview_player
Показать описание
PHP7 has brought new features to the table with generators. Allowing return statements in generator functions and also allows for inheritance of other generator functions. So now we can pull in the stop signs from one function to another using the yield from syntax just like we can with arrays and associative arrays.
Рекомендации по теме
Комментарии
Автор

What a great content dude... dont even realized there is a generator function in PHP until i read Modern PHP and then i found your channell. Anyway I came from Java and Javascript programming where in JS Generator Function is really helpful for making async call behave like sync call. Great Stuff Man. Keep it coming. God bless you.

ToniLiem
Автор

wow, really cool content. good examples

kevinfeniks
Автор

I'd like to ask a question which may seem dumb but be kind in your response please. How is that a txt file can contain millions of lines of text, but querying DB for say 100k records can lead to out of memory exception. Say it is this same text file whose contents have been uploaded to DB, why does it happen so?

truthseeker
Автор

I struggle to find a regular application of this feature, it's a very "forced" concept. Will this evolve into regular multithreading like Java? That would be useful. But this pausing thing..

nagyzoli