/    Sign up×
Community /Pin to ProfileBookmark

unterminated string literal syntax error and php

hi every one
i have problem with javascript that generated using PHP i have a multiline string
that breaks using a <br> tag and at this position i get error by javascript
[COLOR=Silver]unterminated string literal syntax error[/COLOR]
i put here my php code:
original text is here

<div style=”text-align: right;”>some text here <br>
next line is here<br>
third line is here<br>
</div>
“);
i am using => $body=ereg_replace(‘<br>’,’+”<br>”+’,$body);//$body contains the code
but the results is it
<div style=”text-align: right;”>some text here “+<br>”+
next line is here”+”<br>”
third line is here”+”<br>”
</div>
“);
i think i must do some to change it like below
[COLOR=SlateGray]<div style=”text-align: right;”>some text here “+<br>”+
“next line is here”+”<br>”+
“third line is here”+”<br>”+
</div>
“);[/COLOR]

any idea to fix thes problem.
thanks in advance arqa.

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@chrysJun 22.2005 — You cannot put a line break in a javascript string, meaning a new line.

You can use n, but not an actual new line by pressing enter in your code editor. That is why you are getting the error.
×

Success!

Help @arqa spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.12,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...