Okay, I know the mark must be extremely small to test, but I notice the "Conditional operator" slightly use less php memory.
which here is my test;
PHP Code:
if($orderType=='DESC'){$orderType='DESC';}
elseif($orderType=='ASC'){$orderType='ASC';}
else{$orderType='ASC';}
or (Conditional operator)
PHP Code:
$orderType = $oType == 'DESC' ? 'DESC' : 'ASC' ;
Same type of idea, just using a different method. but as building larger application, speed and resources are critical.
also just realized could use the "switch/case" in this test as well.
PHP Code:
switch($oType)
{
case 'DESC':$orderType = 'DESC';break;
case 'ASC':$orderType = 'ASC';break;
}
Which you rather use? if statement yes is easier to read.