Monday, July 25, 2011

PHP difference between single and double quotes

1. Single quote treat all variable as string. while double quotes treat variable and string diferent.
2. 'Single quote ' are effective with . (concatenation operator), while less need of . operator by using "double quote"

example:

Double Quote


$my_var_name=120;


echo "the value is $_my_var_name";


output is:


the value is 120


----------------------------------------------------------



Single Quote

$my_var_name=120;

echo "the value is $_my_var_name";

output is:

the value is $_my_var_name 



So i think ,the difference clear to you.


0 comments:

Post a Comment