JavaScript syntax highlighting doesn't work with long heredoc variable

hi, 
for some purpose, i create a js script inside a php heredoc var. like this: 
$my_script = <<<HERE
<script> 
//js here 
</script>
HERE;
the problem is that JavaScript syntax highlighting doesn't work with long heredoc variable.
is there any solution?
thank you

0

Hi there,

Hmmm... seems to work for me.

Anyway: please use HTML as a tag name instead of HERE, it will force HTML instead of autodetection.

<?php declare(strict_types=1);

$my_script = <<<HTML
<script> 
//js here 
</script>
HTML;

 

0

请先登录再写评论。