{"id":883,"date":"2012-08-29T07:52:20","date_gmt":"2012-08-29T07:52:20","guid":{"rendered":"http:\/\/www.websitedesignwebsitedevelopment.com\/?p=883"},"modified":"2014-03-19T09:13:48","modified_gmt":"2014-03-19T09:13:48","slug":"syntaxerror-unterminated-string-literal-phpxhtml-string","status":"publish","type":"post","link":"https:\/\/androidbubble.com\/blog\/website-development\/javascript\/syntaxerror-unterminated-string-literal-phpxhtml-string\/","title":{"rendered":"SyntaxError: unterminated string literal &#8211; PHP\/XHTML String"},"content":{"rendered":"<h2>SyntaxError: unterminated string literal &#8211; PHP\/XHTML String<\/h2>\n<p><code>&lt;?php $string = addslashes(preg_replace(\"\/[\\r\\n]+\/\",' ',(preg_replace('\/\\s\\s+\/', ' ', include(\"xhtml_page.php\")))); ?&gt;<\/code><\/p>\n<h3>Note:<\/h3>\n<p>New lines in string will be removed and the string will be a valid string instead of unterminated string in javascript.<\/p>\n<p><code>&lt;script type=\"text\/javascript\" language=\"javascript\"&gt;var js_str = '&lt;?php echo $string; ?&gt;';&lt;\/script&gt;<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>SyntaxError: unterminated string literal &#8211; PHP\/XHTML String &lt;?php $string = addslashes(preg_replace(&#8220;\/[\\r\\n]+\/&#8221;,&#8217; &#8216;,(preg_replace(&#8216;\/\\s\\s+\/&#8217;, &#8216; &#8216;, include(&#8220;xhtml_page.php&#8221;)))); ?&gt; Note: New lines in string will be removed and the string will be a valid string instead of unterminated string in javascript. &lt;script type=&#8221;text\/javascript&#8221; language=&#8221;javascript&#8221;&gt;var js_str = &#8216;&lt;?php echo $string; ?&gt;&#8217;;&lt;\/script&gt;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[26],"tags":[],"class_list":["post-883","post","type-post","status-publish","format-standard","hentry","category-javascript"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>SyntaxError: unterminated string literal - PHP\/XHTML String<\/title>\n<meta name=\"description\" content=\"SyntaxError: unterminated string literal - PHP\/XHTML String\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/androidbubble.com\/blog\/website-development\/javascript\/syntaxerror-unterminated-string-literal-phpxhtml-string\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SyntaxError: unterminated string literal - PHP\/XHTML String\" \/>\n<meta property=\"og:description\" content=\"SyntaxError: unterminated string literal - PHP\/XHTML String\" \/>\n<meta property=\"og:url\" content=\"https:\/\/androidbubble.com\/blog\/website-development\/javascript\/syntaxerror-unterminated-string-literal-phpxhtml-string\/\" \/>\n<meta property=\"og:site_name\" content=\"AndroidBubble Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/pages\/Website-Design-Website-Development\/172363336135453\" \/>\n<meta property=\"article:published_time\" content=\"2012-08-29T07:52:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-03-19T09:13:48+00:00\" \/>\n<meta name=\"author\" content=\"Fahad\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fahad\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/javascript\/syntaxerror-unterminated-string-literal-phpxhtml-string\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/javascript\/syntaxerror-unterminated-string-literal-phpxhtml-string\/\"},\"author\":{\"name\":\"Fahad\",\"@id\":\"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7\"},\"headline\":\"SyntaxError: unterminated string literal &#8211; PHP\/XHTML String\",\"datePublished\":\"2012-08-29T07:52:20+00:00\",\"dateModified\":\"2014-03-19T09:13:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/javascript\/syntaxerror-unterminated-string-literal-phpxhtml-string\/\"},\"wordCount\":38,\"articleSection\":[\"Javascript\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/javascript\/syntaxerror-unterminated-string-literal-phpxhtml-string\/\",\"url\":\"https:\/\/androidbubble.com\/blog\/website-development\/javascript\/syntaxerror-unterminated-string-literal-phpxhtml-string\/\",\"name\":\"SyntaxError: unterminated string literal - PHP\/XHTML String\",\"isPartOf\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/#website\"},\"datePublished\":\"2012-08-29T07:52:20+00:00\",\"dateModified\":\"2014-03-19T09:13:48+00:00\",\"author\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7\"},\"description\":\"SyntaxError: unterminated string literal - PHP\/XHTML String\",\"breadcrumb\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/javascript\/syntaxerror-unterminated-string-literal-phpxhtml-string\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/androidbubble.com\/blog\/website-development\/javascript\/syntaxerror-unterminated-string-literal-phpxhtml-string\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/javascript\/syntaxerror-unterminated-string-literal-phpxhtml-string\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/androidbubble.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Website Development\",\"item\":\"https:\/\/androidbubble.com\/blog\/category\/website-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Javascript\",\"item\":\"https:\/\/androidbubble.com\/blog\/category\/website-development\/javascript\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"SyntaxError: unterminated string literal &#8211; PHP\/XHTML String\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/androidbubble.com\/blog\/#website\",\"url\":\"https:\/\/androidbubble.com\/blog\/\",\"name\":\"AndroidBubble Blog\",\"description\":\"Articles &amp; Posts\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/androidbubble.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7\",\"name\":\"Fahad\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/afab5bcad71955d142a69df1758e6710aed4ab9cc2b5da28c54a7c3f39801b73?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/afab5bcad71955d142a69df1758e6710aed4ab9cc2b5da28c54a7c3f39801b73?s=96&d=mm&r=g\",\"caption\":\"Fahad\"},\"sameAs\":[\"http:\/\/www.androidbubbles.com\/\",\"https:\/\/x.com\/phpFlex\"],\"url\":\"https:\/\/androidbubble.com\/blog\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SyntaxError: unterminated string literal - PHP\/XHTML String","description":"SyntaxError: unterminated string literal - PHP\/XHTML String","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/androidbubble.com\/blog\/website-development\/javascript\/syntaxerror-unterminated-string-literal-phpxhtml-string\/","og_locale":"en_US","og_type":"article","og_title":"SyntaxError: unterminated string literal - PHP\/XHTML String","og_description":"SyntaxError: unterminated string literal - PHP\/XHTML String","og_url":"https:\/\/androidbubble.com\/blog\/website-development\/javascript\/syntaxerror-unterminated-string-literal-phpxhtml-string\/","og_site_name":"AndroidBubble Blog","article_publisher":"https:\/\/www.facebook.com\/pages\/Website-Design-Website-Development\/172363336135453","article_published_time":"2012-08-29T07:52:20+00:00","article_modified_time":"2014-03-19T09:13:48+00:00","author":"Fahad","twitter_misc":{"Written by":"Fahad"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/androidbubble.com\/blog\/website-development\/javascript\/syntaxerror-unterminated-string-literal-phpxhtml-string\/#article","isPartOf":{"@id":"https:\/\/androidbubble.com\/blog\/website-development\/javascript\/syntaxerror-unterminated-string-literal-phpxhtml-string\/"},"author":{"name":"Fahad","@id":"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7"},"headline":"SyntaxError: unterminated string literal &#8211; PHP\/XHTML String","datePublished":"2012-08-29T07:52:20+00:00","dateModified":"2014-03-19T09:13:48+00:00","mainEntityOfPage":{"@id":"https:\/\/androidbubble.com\/blog\/website-development\/javascript\/syntaxerror-unterminated-string-literal-phpxhtml-string\/"},"wordCount":38,"articleSection":["Javascript"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/androidbubble.com\/blog\/website-development\/javascript\/syntaxerror-unterminated-string-literal-phpxhtml-string\/","url":"https:\/\/androidbubble.com\/blog\/website-development\/javascript\/syntaxerror-unterminated-string-literal-phpxhtml-string\/","name":"SyntaxError: unterminated string literal - PHP\/XHTML String","isPartOf":{"@id":"https:\/\/androidbubble.com\/blog\/#website"},"datePublished":"2012-08-29T07:52:20+00:00","dateModified":"2014-03-19T09:13:48+00:00","author":{"@id":"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7"},"description":"SyntaxError: unterminated string literal - PHP\/XHTML String","breadcrumb":{"@id":"https:\/\/androidbubble.com\/blog\/website-development\/javascript\/syntaxerror-unterminated-string-literal-phpxhtml-string\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/androidbubble.com\/blog\/website-development\/javascript\/syntaxerror-unterminated-string-literal-phpxhtml-string\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/androidbubble.com\/blog\/website-development\/javascript\/syntaxerror-unterminated-string-literal-phpxhtml-string\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/androidbubble.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Website Development","item":"https:\/\/androidbubble.com\/blog\/category\/website-development\/"},{"@type":"ListItem","position":3,"name":"Javascript","item":"https:\/\/androidbubble.com\/blog\/category\/website-development\/javascript\/"},{"@type":"ListItem","position":4,"name":"SyntaxError: unterminated string literal &#8211; PHP\/XHTML String"}]},{"@type":"WebSite","@id":"https:\/\/androidbubble.com\/blog\/#website","url":"https:\/\/androidbubble.com\/blog\/","name":"AndroidBubble Blog","description":"Articles &amp; Posts","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/androidbubble.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7","name":"Fahad","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/afab5bcad71955d142a69df1758e6710aed4ab9cc2b5da28c54a7c3f39801b73?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/afab5bcad71955d142a69df1758e6710aed4ab9cc2b5da28c54a7c3f39801b73?s=96&d=mm&r=g","caption":"Fahad"},"sameAs":["http:\/\/www.androidbubbles.com\/","https:\/\/x.com\/phpFlex"],"url":"https:\/\/androidbubble.com\/blog\/author\/admin\/"}]}},"views":1301,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/posts\/883","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/comments?post=883"}],"version-history":[{"count":4,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/posts\/883\/revisions"}],"predecessor-version":[{"id":1614,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/posts\/883\/revisions\/1614"}],"wp:attachment":[{"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/media?parent=883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/categories?post=883"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/tags?post=883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}