In PHP, which is a better way to concatenate strings (with a single-quote) in terms of resources?
"Sal's mall is $emo."
Or:
"Sal's mall is ".$emo.'.'
Or:
'Sal\'s mall is '.$emo.'.'
In PHP, which is a better way to concatenate strings (with a single-quote) in terms of resources?
"Sal's mall is $emo."
Or:
"Sal's mall is ".$emo.'.'
Or:
'Sal\'s mall is '.$emo.'.'
There is no difference.
Learn to profile your app before asking performance related questions.
Never mind micro-optimization. Choose what makes your code more readable.
The third way is more efficient (slightly). You can test it by yourself doing a loop:
Trust me... if you have to ask, there's not going to be any meaningful difference in speed relative to the rest of your page load.
Well, when you use single quotes, PHP assumes it's just a string, but if you use double quotes, it's gonna parse it to find variables inside. So, using single quotes and concatenation is more efficient. Anyways, you have to test it for yourself and compare the results.