PHP » GoLang |
login |
register |
about
|
GoLang Generator::send
request it (392)
GoLang replacement for PHP's Generator::send
[edit | history]
Generator::send(PHP 5 >= 5.5.0, PHP 7) Generator::send — Send a value to the generator DescriptionSends the given value to the generator as the result of the current yield expression and resumes execution of the generator. If the generator is not at a yield expression when this method is called, it will first be let to advance to the first yield expression before sending the value. As such it is not necessary to "prime" PHP generators with a Generator::next() call (like it is done in Python). Parameters
Return ValuesReturns the yielded value. Examples
Example #1 Using Generator::send() to inject values
<?php The above example will output: I'm printer! Hello world! Bye world! |
more
Recently updated
more
Most requested
more
Last requests
|