PHP Assign a value to a var from IF statement variable
<p>I have something like this:</p>

<pre><code>$msg    = '';
$var1   = 'image';
$var2   = 'class';
$var3   = 'This '.$var1.' has this class assigned:'.$var2;

if($E == 0) {
    $msg   = $var3;
} else {
    $var1  = 'no image'; 
    $var2  = 'no class'; 
    $msg   = $var3;
};

echo $msg;
</code></pre>

<p>I want to be able to show $var3 with the modified results but it does not work...
Thank you for your answers but i think i must clarify</p>

<p>Sorry about the confusion.. </p>

<p>The problem is not with the value to test ($E == 0).. My problem is that in both case the result will be the same and $var1 and $var2 will not change...</p>

<p>result in both cases will be the same: 
echo $msg; will produce "This image has this class assigned: class "</p>

<p>I think is because of the composing of $var3 outside the if and cannot be changed from inside IF statement..</p>
