+ 3
Did someone notice a difference between using echo "some_text" and echo 'some_text'?
6 Respostas
+ 9
When writing variables in double quotes they are parsed, in single quotes they aren't.
For example:
$x = 'World!';
echo 'Hello $x'; //Output: Hello $x
echo "Hello $x"; //Output Hello World!
0
Ok Patrick... I read somewhere that if you need quotes marks to appear in your text in the browser you use both of them (like your example).. the result in the browser would be: some 'text'
Is there another difference besides escaping single and double quotes to the text?
0
Hmm I'm also a little bit confused about this. The only thing I can say is that single quotes should parse faster. There are little differences with using \ in the double and single quotes but I don't really get the point of the explanations in the internet...
0
Both are similar but it helps to know strings and characters
- 1
it's completely the same.
but sometimes you have to use both of them and then you need two types: echo "some 'text' "
- 1
I think it doesn't matter both will work