I will print the string in PHP, but in a string in there middle of in string double quotes
, single quotes
string also .So I will not get the expected output.
My code Below:
<?php
$str = "Couldn't pay via card";
echo $str . " New "home" away from home when in Bangkok";
echo addslashes($str) . " This is safe in a database query.";
?>
I will useaddslashes() function of PHP to display the string but there some error occurred
output :
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in on line no 5.
How it can be solved?