A me lo prende senza problemi:

Codice PHP:

<?php $msg 'Hello World!'?>
<script language="javascript">
alert('<?php echo($msg); ?>');
</script>