HEREDOC interfering with code indentation

后端 未结 6 1075
没有蜡笔的小新
没有蜡笔的小新 2020-12-03 10:48

I like the HEREDOC syntax, e.g. for edge cases of generated HTML that are not worth putting into a template.

The only thing that annoys me about it, though, is that

6条回答
  •  失恋的感觉
    2020-12-03 11:14

    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 = <<

提交回复
热议问题