Since PHP 8.3, there can be a comment, inserted between the yield and the from.
yield
from
In previous versions, this would not compile, unless there was a defined constant called from.
<?php function foo() { yield /*a*/ from [3]; } foreach(foo() as $i) { print $i; } ?>
PHP Fatal error: Uncaught Error: Undefined constant "from" Fatal error: Uncaught Error: Undefined constant "from"
3
This behavior changed in 8.3
Undefined constant “%s”
All features that changes between PHP versions.
Contents:
max_depth
Comment Inside yield from¶
Since PHP 8.3, there can be a comment, inserted between the
yieldand thefrom.In previous versions, this would not compile, unless there was a defined constant called
from.PHP code¶
Before¶
After¶
3PHP version change¶
This behavior changed in 8.3
Error Messages¶