My code is
$message="We're looking at developing our website.";
$body= "My message is,\n\n\n\n\t\t\t".$message";
echo $body;
I get result
We\'re looking at developing our website.
Can any body tell me how to remove \ from the printed string?
Thanks in advance
how to remove \ in php string display
Moderator: General Moderators
Re: how to remove \ in php string display
Use
Code: Select all
<?php
stripslashes($str);
?>
Re: how to remove \ in php string display
Alternatively, if you have access to the config.ini file, turn magic_quotes_gpc to off, and remember to escape strings with mysql_real_escape_string() when you are performing an SQL query.
Re: how to remove \ in php string display
Oooooor, if you don't have access to your php.ini, you can turn off magic quotes in a htaccess file with a php_flag.
Re: how to remove \ in php string display
Aaaaaaaaand you can post in the correct section. Coding Critique is not for general coding questions, help with errors, etc.