Modern PHP: Difference between revisions

From Rixort Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
== Generators ==
Generators are similar to iterators that calculate their values on demand, thus potentially using fewer resources. They can be created using the <code>yield</code> keyword, e.g.:
function my_generator()
{
  yield 1;
  yield 2;
  yield 3;
}
== Useful dependencies ==
== Useful dependencies ==



Revision as of 19:37, 10 April 2018

Generators

Generators are similar to iterators that calculate their values on demand, thus potentially using fewer resources. They can be created using the yield keyword, e.g.:

function my_generator()
{
  yield 1;
  yield 2;
  yield 3;
}

Useful dependencies

Links