Welcome to Webmaster Resources 101


Our Network:

Stopping Quotation Mark Errors in PHP

[ About This Author :: Request Reprint :: Print Article :: Tell A Friend ]

Stopping Quotation Mark Errors in PHP

By Ben Sinclair
http://www.webmaster-resources101.com

-------------------------------------------------------------------
Note: This is a tutorial I wrote when I was learning PHP. It
might come in handy for you too :D
-------------------------------------------------------------------

Do you get errors when you write something like this:

<?php
if ($this == "that") {
print "Hello! This is a piece of "text!" Cool huh?";
}
?>


You will get errors until you remove the Quotation Marks(QA). How can you have a QA without getting errors? Simply but putting a Backslash(BS) in front of it:

<?php
if ($this == "that") {
print "Hello! This is a piece of "text!" Cool huh?";
}
?>


"What if I have 100's of QA's already and don't want to put a BS in front?"

That's easy too! You just put an end tag before the text and a start tag after the text:

<?php
if ($this == "that") {
?>
Hello! This is a piece of "text!" Cool huh? I can have as many " as I like! See: " " " " " etc. etc. :D
<?php
}
?>


That's how you do it.

Hope that helps!

 
Other Related Material:

Discuss this in our Webmaster Forums

About The Author:
Ben Sinclair
http://www.webmaster-resources101.com
Ben Sinclair is the Webmaster of [url=http://www.webmaster-resources101.com/]Webmaster Resources 101[/url] and [url=http://www.webmaster-forums101.com/]Webmaster Forums 101[/url].
Go To Top

This article has been read 1667 times.

[ About This Author :: Request Reprint :: Print Article :: Tell A Friend ]