Usage Of - Single Quote - And - Double Quote - With Strings In PHP Posted By - Ko Ko - January 5, 2007Summary : How to use -single quote- and -double quote- with strings in PHP
Usage of 'single quotes' and 'double quotes' in Strings In PHP, a string is simply a group of characters. They can contain:-
When you assign a string to a variable (or) echo the string out to the browser, you have to mark the start and end of the string. The ways of doing this are:
The two methods looks similar but they are slightly different. Look at the following codes:-
You will see that the output of above are different.
In the first code line, a variable was put between a pair of
double quote. Its value Sally was displayed by the browser
In the next code line, a variable was put between a pair of
single quote. Its value Sally was not displayed by the browser. Play around with single and double quotes with different strings and variables and observe the differences. |