Hi

On 9/19/22 16:24, Olle Härstedt wrote:
$query = <<<MySQL
SELECT * FROM foo
MySQL;

It would be nice if this feature could be used in single lines as well:

$query = <<<MySQL SELECT * FROM foo MySQL;


I don't find that example particularly readable or convincing. It mushes together PHP and MySQL keywords too much.

Once you add a WHERE clause that SQL query should be split across multiple multiple lines for readability anyway and even for that very simple example I personally would add a linebreak in front of the FROM:

$query = <<<MySQL
    SELECT *
    FROM   foo
    MySQL;

Best regards
Tim Düsterhus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to