code optimization

Reliability and readability are more important than code micro-optimizations.
But there are some methods to improve code-optimization and speed of script without harming readability.
For example expensive_function() should be last inside of if-condition because if "counter < X" will be true than expensive_function() will not be executed.

<?php
if ( counter < X || expensive_function() ) {}
?>

Leave a Reply

Your email address will not be published. Required fields are marked *