Like This Site? 
 
RSS Feed Follow Us 

on Twitter! Be Our Fan!

PHP Optimization - Theory and Practise

Share this post!
 Vote this!

One of the first things I will discuss are about quotes, these silly " or ' things you may had been using for quite some time. It was once a rumor that double quotes were slower or single quotes were faster, but they are basically the same thing in recent versions.

The only thing you will wish to optimize here is to try to avoid "cramming" variables into a string, such as "$a plays $b and $c = $d" as this will be hard for the interpreter to recover from, especially cramming arrays into a string. Single quotes are generally more simple to read by the parser and should be used unless you require escapes such as \r \n \t \" to be used in your text.

A simple hint: You will want to stay away from heredoc syntax for this reason, breaking out of PHP will be much faster to write HTML blocks or non-dynamic data, an example is this:  more...

0 comments:

Post a Comment