Send An Argument To Generator

no-email (Rahul Chavan), Rahul Chavan
Mon, 05 Aug 2024 00:00:00 +0000

When calling the method send() on a PHP generator, the result of the first yield keyword is the argument value. Then, it can be used to yield a specific result.
Upon usage on a foreach(), that generator will generate 2 values.
Generator::send() only accepts one argument.