- if you were to use between print or echo… use echo (Echo is known to be faster than print)
- when doing string searches or action, do not simply/quickly jump on regex, but first have a look at php api’s string functions such as strpbrk, stripos etc..
- Display smart error messages… A lot of young developers like to display a custom error or show systems errors whenever something break. Although it is good practice to alert the user of any error, keep in mind printing Error cost a lot in resources. Go for general error display then specifics.
- Close your database connections when you are done processing mysql datas
- Use variables instead of global variables
- Always initialize your variables… It seems too common for coders to just declare a variable without initializing it and process it later with increments etc… Remember you are loosing on speed with none initialized variables
- Whenever you echo a string on the string.. use ‘ ’ instead of “ “… why? because PHP will look inside the ” “ declaration for any variables “$”… the process is therefore slower
- Use mem-cached with apache as to cache memory objects. This will highly speed up the runtime execution of your web application
- Use mod_gzip to compress data delivery
- Implement data structure as array and not as class
and yes… :-) use less OOP as possible, being a JAVA and .NET programmer, I can guarantee that OOP in PHP is just a big overhead.