<?php $paper='cotton'; ?>
<?php echo $color; ?>// outputs black wrongly
But now if I rename or eliminate the $color in the final else portion following two conditions // it outputs red as it always should
It seems to work (outputting 'red') if the else is directly associated with the conditional, like this:
if ($paper == 'cotton'){
$color = 'red';
$marker = 'pencil';
} else {
$color = 'black';
}
But not when occuring at the end of series of 'if' conditions.
Why? I must have the same variable values applied to all if they are not specified within each condition & and each condition spells out different variables out of the total possible. What would cause them to be called out of order?
Is there a way to better group the curly braces to help bind the statement?