How to escape $ in the JS block yii2?

$js = <<<JS
var $a = 'a';
JS;

We need to implement this syntax. But the $a is perceived as a php variable. How can I bypass this?
April 19th 20 at 12:01
2 answers
April 19th 20 at 12:03
Solution
Possible to jacket:
$js = <<<JS
var \$a = 'a';
JS;
April 19th 20 at 12:05
Solution
If the code does not need to use PHP variables, you need to wrap the JS after the <<< in single quotes:

$js = <<<'JS'
var $a = 'a';
JS;

Find more questions by tags PHP