This may be a very basic question, but I have struggled to find a suitable answer. And my first question, so please be gentle.
When combining strings with variables, I understand that enclosing variables within a single-quoted string will not expand the variable, whereas double quoted strings will expand the variable (and other special characters), giving rise to the syntax in the two examples:
$animal1='brown fox';
$animal2='lazy dog';
echo "The quick $animal1 jumps over the $animal2";
echo 'The quick '.$animal1.' jumps over the '.$animal2;
I recall reading that PHP parses single quote encapsulated strings faster than double quoted encapsulated strings, because it is not spending time looking for variables that it needs to resolve. Is this true? If so, is this gain lost when concatenating a string and a variable, as in the second example?
My main question is: When working with strings and variables, as in the above examples, is either way of encapsulating preferable?