Testing for $_POST var affects variable even though $_POST should be undefined
<p>I have used for years this method of testing for a $_POST var and assigning a value to $var simultaneously. </p>

<p>Today I ran into a server that seems to be different in its handling of this.</p>

<p>I'm loading the page  <a href="http://site.com/foo.php?var=bar" rel="nofollow">http://site.com/foo.php?var=bar</a>   No form post made...  and testing for $_POST var seems to unset my initial assignment </p>

<pre><code>$var= $_GET['var'];

echo "var is $var\n";  // correctly echos $_GET['var'] 

if ($var= $_POST['foo']) {
    echo "POST foo seen\n";  // does not fire, condition not met
}

echo "var is $var\n";  // does not echo $_GET['var'] 
</code></pre>

<p>When I switched to </p>

<pre><code>if (isset($_POST['foo'])) {
    $var = $_POST['foo'];
...
</code></pre>

<p>I got rid of the unsetting behavior.</p>

<p>So my question is whether this <code>if ($var= $_POST['foo']) {</code> is bad form?</p>
