On 19 September 2022 15:24:26 BST, "Olle Härstedt" <
olle.haerst...@limesurvey.org> wrote:
>Some editors can guess the domain-specific language inside heredoc, e.g.
if you do
>
>$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;
>
Good news! This feature exists and was introduced by Rasmus **checks
notes** about 25 years ago.

To use it, you'll want to hold down your shift key, then press the key just
to the left of your enter key.  This is called a "quote", and you can see
it demonstrated here around the word quote.

Hope that helps!

Seriously though, I know you're looking to help your editor find something
to syntax highlight, but this is an editor problem, not a PHP language
problem.  If your editor can detect SQL in heredoc, then it should be able
to improve and find it in interpolated strings.  Making the parser more
complex for no benefit to the actual language (some detriment, I would
argue) is not the fix here.

-Sara

P.S. - Yes, I'm assuming a US layout, you know where your quote key is.

Reply via email to