Line Break In Alert Box Based On Php Variable

How do I get the line break to work in an alert box based on data from this php variable?

<?php
$myPhpVar = '"Hello again! This is how we" . "\
" . "add line breaks to an alert box!"';
echo '<script type="text/javascript">';
echo 'alert(' . $myPhpVar . ');';
echo '</script>';
?>

Have you tried this?


<?php
$myPhpVar = '"Hello again! This is how we" . "\
" . "add line breaks to an alert box!"';
?>
<script type="text/javascript">
  alert("<?php echo $myPhpVar; ?>");
</script>

Why are you generating alerts from PHP when the only purpose for alerts in the 21st Century is for debuggung JavaScript (which is why some languages include an option in alerts for either turning off further alerts or disabling Javascript for the page).

I’ll use the alerts to monitor incremental changes in mysql tables.