I am new to php and I have some problem dealing with quotes in strings.
I am trying to I pull out some data from an access database table, the string stored
in "Authors" field is
David Peng<>s \"home\" is here
Here is code I have:
$temp=odbc_result( $cur, "Authors");//$cur is the result of the database query
echo $temp;
and I got the result
David Peng<>s \"home\" is here
The result is exactly the same as the string I stored in database, the backslash used to escape quotes still exist.
But when I echo the same string:
echo "David Peng<>s \"home\" is here"
I get the result David Peng<>s "home" is here
And the backslash before the double quotes do not show up in the result.
I am wondering Why the backslash before the double quotes exist when
I use echo $temp? But when I echo the string directly the backslash disappear?
Can anybody help?
David