Main /

PHP Tricks

Wiki_System*

technolowiki.org

[-edit SideBar-]

PHP Tricks

PHP Optimizations

&

& (reference) is not always good. using it on function return values and class instancing (new operator) slows the script down.
when looking up in a single-dimensional array, referencing the resulting value speeds up. for multi-dimensional arrays, it slows down.

F

foreach is said to be nearly 4 times slower than a key extract with array_keys() with a loop following.

I

is_array() can be expensive. using isset()/!empty() before can save time.

S

switch is said to be equally fast as if/elseif/else - the only thing that can make it faster is using the "===" operator for the if-comparisons.

Recent Changes (All) | Edit SideBar Page last modified on June 24, 2010, at 10:08 PM Edit Page | Page History
Powered by TechnoloWiki