Here is my code to check the number of possible conditions for two elements, Is there a way to reduce the number of checking conditions (not any specific rule for checking).
Why i am asking is, I fear that if I add an additional element it will maximise the checking conditions in a vast manner.
How can I do this?
Here is my code:
<?php
$A = 'alpha';
$B = 'beta';
$result = '';
if($A != '' && $B !='')
{
$result .= 'Both has Value';
// both contains value
}
elseif($A != '' && $B =='')
{
$result .= 'Only A';
// only a contains value
}
elseif($A == '' && $B !='')
{
$result .= 'Only A';
// only b contains value
}
else
{
$result .= 'Both are Empty';
// both contains no value
}
echo $A.' - '.$B.'<br>';
echo $result;
?>