+ 2
What is the difference between single and double quotes in php
3 odpowiedzi
+ 2
There is some technical difference:
- single quotes are slightly faster
- echo '$var' will output: $var
- and echo "$var" will output value of $var
+ 1
there's technically no difference. You'll get the same result by doing this
<?php
print("hello world\n");
print('hello world\n');
?>
the reason it's built like this is to give you the chance to nest quotes inside quotes.
"he said "hello"." would be interpreted as two strings and a hello in the middle.
'he said "hello".' would be interpreted as one string.
0
forsberg that I did not know! thanks for the knowledge