Nowości 
Produkty 
Artykuły 
Inne 
Kilka uwag odnośnie optymalizacji kodu PHP 23-02-2006


Na stronie http://trac.pradosoft.com/wiki/Development/CodingGuidelines możemy znaleźć kilka ciekawych uwag odnośnie optymalizacji kodu PHP:



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




Lubię czytać