Is it possible to write javascript in a php heredoc syntax? : I'm trying to put javascript coding in a heredoc syntax and I want it to be printed out with the php  print_r method. Is it possible to do that?

PHP
  

    <?php
                function printR($val){
                  echo "<pre>";
                  print_r($val);
                  echo "</pre>";
                }
    
               
    
                $str = <<<EOT
                var msg = "Hello my name is ";
                var name = "Jermaine Forbes";
                function writeIt(m,n){
    
                  console.log(m+n);
                }
    
                writeIt(msg,name);
    
                EOT;
                
                printR($str);
                ?>