> 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
That looks good in isolation, but consider the following short snippet: class Foo { public function bar() { $query = <<<MySQL SELECT * FROM baz MySQL; } } As you can see, the heredoc breaks the reading flow completely. For smaller SQL queries, using one line would be an improvement, I think. Also consider that the one line will look better in your color highlight editor. :) Olle -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php