Questions | Login

Top / PHP

How do you use quotes in PHP?

demo 17 Dec 2008 12:30pm
Quotes like " and ', how do you add them to strings to PHP without ending the string or using Chr()?

Answers

demo 17 Dec 2008 12:35pm
" or ' generally work.
demo 17 Dec 2008 12:45pm
You can do this:

$myvar = "hello this string has some ' ' ' ' single quotes";

or
$myvar = 'this string contains " " " double quotes';

and you can escape them with backslash
$myvar = "this string also contains " " " double quotes";
demo 19 Dec 2008 06:16pm
simply escape the " like "

so

echo "<a href="http://something.com">Something</a>";

Related

Submit Answer

You must be logged in to post an answer. Please Login or Register.

Powered by phpMyAnswers.