SyntaxError: unterminated string literal – PHP/XHTML String
<?php $string = addslashes(preg_replace("/[\r\n]+/",' ',(preg_replace('/\s\s+/', ' ', include("xhtml_page.php")))); ?>
Note:
New lines in string will be removed and the string will be a valid string instead of unterminated string in javascript.
<script type="text/javascript" language="javascript">var js_str = '<?php echo $string; ?>';</script>
Last updated: March 19, 2014