PHP Questions Home | Register | Login
Categories
Arrays
Files
Forms
Creating PDFs
PHP Errors
Functions
Images
MySQL
Numbers
Others
Strings
Website
Unanswered

PHP Forums
Forums Index
MySQL Forum
PHP Forum
Flash/Actionscript
Javascript
Web design

More PHP
PHP Functions
Top Questions
Ask a Question
PHP Interview Questions
PHP Jobs
Ecommerce
IT Questions
Business Websites

Sponsors

sponsor ad
My Salary
PHP Developer Salary
Advertise Here

How do I print the " in an echo statement?


If you are printing content to the screen and you have a double quote in it, you will get a parse error:

<?php
echo "this will give a "parse error"";
?>

There are two ways around this. First you can simply enclose with single quotes instead.

The second option is to escape the quotes like this with a backslash:

<?php
echo "Relief at last, no dreaded \"parse errors\" in sight!";
?>



Comment on this Question and Answer >>>

ASK A QUESTION

More strings PHP Questions

how to compare strings in PHP?

How do I count the number of words in my text?

How can I remove trailing space from a string?

How do I make sure a string is a certain length?

What is the usage of {} in strings?



Custom Search