Evaluating conditions and arguments is the heart of programming logic. But you can streamline your logic flow by assinging your values to varibles to help aid in redundant evaluations from methods and functions that can take up valuable resources.
For example, using logic operator procedence, you can streamline a conditional statement:
PHP Code:
// Not streamlined: if (resource_intensive_method() OR (!resource_intensive_method() AND $a == $b)) // Streamlined: if ($value = resource_intensive_method() OR (!$value AND $a == $b))
__________________
<mgraphic /> - I don't have a solution but I admire the problem.
|