variable changes when using if statement : <p>I've just started learning php an hour ago. I've made this code:</p>

<pre><code>$x=2;  
$y=4;  
echo $x;  
echo $y;  

if($x=5) 
{    
    echo "$x";  
}  
else  
{  
    echo "test";  
}
</code></pre>

<p>I'm expecting the output: 24test</p>

<p>I'm getting the output: 245</p>

<p>x equals 2 in the beginning. Why is x then changing to 5 when the only thing I do is CHECKING whether x = 5?</p>

<p>I've searched the web and this site for an answer but couldn't find anything. Thanks in advance!</p>

<p>Tony</p>
