PHP Web Development Tips and Tricks

PHP Web Development Tips and Tricks

Echo() versus print()

Echo is quicker than print. Both functions are used for the same thing but echo is the language constructs which return nothing, which publish will return 0 or 1 based on success or failure.

About accessing arrays

E.g. $row[‘id’] is 7 times faster than $row[id]

Derived classes vs. base classes

You may have to know i.e., methods in derived classes run faster than ones defined in the base class.

Specify full paths

Try to use full paths in includes and requires, for less time spend on resolving the OS paths.

Try to use minimize relative paths

For relative path insertion it will search for default include path then current directory then so on. As a result file search in that case may catch more time.

Use single quotes for longer strings rather than double quotes

Because in double quotes it will search for PHP variable to evaluate them. So in this case, in single quotes is faster because it does not require any string manipulation.