3
Contributors
8
Replies
9
Views
5 Years
Discussion Span
Last Post by diafol
1

Try:

echo stripslashes($str);

But that'll only work with certain combos. Using it to replace \n etc won't work as expected. To get around most of these problems, enclose the string in single quotes '...'.

$str = 'wkvcw\swfvwnl';

Edited by diafol

0

I dont understand can this replace evrything in a php page.
if i put this in a php page?
I'm knew to php.

1

What do you mean change everything in a php page? I assumed you meant change a small string as in the contents of a variable. What are you trying to do? Show your code so far or at least what you're trying to change. Accurately describing your problem will avoid ping-pong discussions.

0

Id like to replace "\" in a php page with this html code in it:

<div id=shadow><b>anonymous </b> on Sunday 10 June 2012  at 15:25 GMT wrote:</br></br> <div style=\"text-align: center;\"><img alt=\"\" src=\"http://image.com\" align=\"none\"><br>test<br></div></div></br>

Is it possible?

1

try:

$file = "myfile.php";
$str = stripslashes(file_get_contents($file));
echo $str;

May be unpredictable w.r.t results - perhaps a more focussed replace of \' or \" would be better?

Edited by diafol

Votes + Comments
Great
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.