PHP String Optimization
Posted on December 31st, 2007 by Jans
You can seek a bit more speed out of your code, especially if you have LOTS of strings, by using single quotes and concanetating variables.
$string = ‘this is a string with ‘.$foo.’ in it’;
// is marginally faster than
$string = “this is a string with $foo in it”;
The reason is php has to search through the string to find the variable.
Filed under: PHP, Tips & Tricks
