Variable isn't rewritten in a foreach loop
<p>I have this php code which I am pretty sure is OK.
But the $category variable isn't rewritten, i.e. even though $category is '251', the if loop does not execute to true.</p>

<p>Any ideas why?</p>

<pre><code>foreach($cars-&gt;cardata as $cardata ){

    $category = $cardata-&gt;categorie;

    if($category == '251'){
        $category = 'BWM';
    }

    echo $category;
}
</code></pre>
