Archive for the ‘Performance’ Category

Single Quotes vs Double Quote

No Comments »

When outputting strings:

Single quotes (‘) with concatenation is faster than putting your variables inside a double quote (“) string.

echo 'a string ' . $name;
// is faster than
echo "a string $name";

OR even better:
Use echo’s multiple parameters instead of string concatenation.

echo 'this', 'is', 'a', $variable, 'string';
//is faster than
echo 'this' . 'is' . 'a' . $variable . 'string';