Yield, Not Return

no-email (Damien Seguy), Damien Seguy
Tue, 09 Jan 2024 00:00:00 +0000

This code displays ``1 2 3``. This is because the ``...`` operator acts as a ``foreach`` and runs the generator. It then spreads the values as arguments for the function call, and, in this case, it matches the needed arguments.
Note that named parameters are also supported, with the good PHP version.
The returned value of the generator is lost, in this case. If you need to access the returned values, you must get the generator, and call the ``getReturn()`` method.