PHP » GoLang |
login |
register |
about
|
GoLang Generator::throw
request it (363)
GoLang replacement for PHP's Generator::throw
[edit | history]
Generator::throw(PHP 5 >= 5.5.0, PHP 7) Generator::throw — Throw an exception into the generator DescriptionThrows an exception into the generator and resumes execution of the generator. The behavior will be the same as if the current yield expression was replaced with a throw $exception statement. If the generator is already closed when this method is invoked, the exception will be thrown in the caller's context instead. Parameters
Return ValuesReturns the yielded value. Examples
Example #1 Throwing an exception into a generator
<?php The above example will output: Foo Exception: Test Bar |
more
Recently updated
more
Most requested
more
Last requests
|