$val = "I'm string";
For this type of string I am using the addslashes function, which convert string into like this:
"I\'m string"
and store into the database. When I get all data from database in array of fields and passed array in
json_encode($arr);
In response I get the string with a extra slash like this:
"I\\'m string"
And I wanted to remove that extra slash which is added by json_encode. how I do that??
If you really want an answer to this question you can reverse your addslashes
with stripslashes
.
But never use addslashes function to escape values you are going to send to mysql.
Use native prepared statements, mysqli_real_escape_string()
or PDO::quote
.
BUT NOTE:
Read more about character set issues here: http://php.net/manual/en/mysqlinfo.concepts.charset.php