Do you know about the difference between the string with in single quotes and double quotes

by ArulKumar 2008-06-02 10:50:41


Both values present inside the Single and Double quotes are assigned to string values. But there is some difference exists between them, that is

Strings which are present inside the single quotes is immutable or string constants. We can not do modification on it afterwards.
ex: str='hellow, welcome'; // string constants assigned to str
echo (str);

Strings which are present inside the double quotes is mutable or string variables. Modifications can be done on string variables.
ex: str="hellow, world"; // string variables assigned to str
echo(str);

Tagged in:

1468
like
0
dislike
0
mail
flag

You must LOGIN to add comments