New in PHP 7.3 – Flexible heredoc syntax

23 May 2020


Heredoc is a useful tool for larger strings, though they have an indentation quirk which always put me off.

To quote from the PHP Requests-for-Comments:

The heredoc and nowdoc syntaxes have very rigid requirements. This has caused them to be, in-part, eschewed by developers because their usage in code can look ugly and harm readability.

PHP 7.3 introduces two changes to the syntax for heredoc and nowdoc syntaxes:

Read More