 |
| PHP code optimization
| Feb 23, 2006 |
On site http://trac.pradosoft.com/wiki/Development/CodingGuidelines we can find some PHP coding tips:
 |
These are all small gotchas. You can get more details about them in the references below.
* ++$i is better than $i++
* for($i=0, $k=count($j); $i<$k; ++$i) is better than for($i=0; $i
* ctype_digit($foo) is better than preg_match("![0-9]+!", $foo)
* if(isset($array['key'])) is better than if(in_array('key', $keys))
* if(!isset($foo{5})) is better than if(strlen($foo) < 5)
* echo is better than print
* true is better than TRUE
* false is better than FALSE
* null is better than NULL
References
1. PHP Optimization Tricks by Ilia Alshanetsky
2. Optimizing PHP Scripts by Leon Atkinson
|
|
 |