Welcome to PHPMule.com
A blog site which I am posting to during my learning of the popular programming language PHP. Feel free to leave comments!
-
PHP - Single vs Double Quotation Marks
In PHP you can use either single quotation marks or double quotation marks. Anything contained between single quotation marks will be treated literally and anything between double quotation marks will be interpreted. For example:
echo ‘Here is a variable and the variable is $var’;
would literally output: Here is a variable and the variable is $var
If you put this line between double quotation marks it would output the following:
Here is a variable and the variable is 15.
There is one case where you may need to alternate the use the single and double quotes. Look at the following example:
echo ‘I will be going on holiday shortly and I’m taking my laptop with me’;
You will notice that you have used the ‘ symbol three times so therefore it will give a parse error. In this case you will have to use the double quotes. By the way this can happen vice versa as well so be careful when using single and double quotes in sentences.
(Post created on Friday, May 1st 09 at 23:35)
-
Calendar
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Jun | ||||||
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
| 29 | 30 | 31 | ||||
Archives
Recent Articles
- PHP - Rounding Off Numbers
- PHP - Single vs Double Quotation Marks
- PHP - Loading Files Into Your PHP Script By Using require() and include()
- PHP - Replacing Strings With Other Strings
- PHP - Finding Strings Within Strings
- PHP - Using strlen() To Test String Length
- PHP - Using The explode() Function
- PHP - Changing The String Case
- PHP - The nl2br() Function
- PHP - Trimming Strings
Links
Categories
- PHP (22)
- Uncategorized (1)


