更新时间:2022-12-18 22:15:58
此功能终于通过RFC通过php 7.3登陆:灵活的Heredoc和Nowdoc语法
Thank goodness this feature has finally landed in php 7.3 via RFC: Flexible Heredoc and Nowdoc Syntaxes
因此,您的示例现在可以清楚地写为:
So now your example can cleanly be written as:
class myclass
{
function __construct()
{
$a = some_code();
$b = some_more_code();
$x = <<<EOT
line1
line2
line3
line4
EOT;
$c = even_more_code();
$b = still_more_code();
}
}