PHP if statement null
<p>I have this <code>if</code> statement in my controller:</p>

<pre><code>if($parent == $page-&gt;parent)
</code></pre>

<p>Where <code>$parent == null</code> sometimes, when <code>$parent</code> is for example <code>16</code> it executes my if statement but only when its null it doesn't execute it what am I doing wrong?</p>

<p>Here's my controller:</p>

<pre><code>public function updateMenu($id)
{
    $page = Page::find($id);
    $parent = Input::get('parent');
    $new_order = Input::get('index');

        if($parent == $page-&gt;parent)
        {
            if($page-&gt;order_id &gt; $new_order)
            {
                DB::table('pages')
                    -&gt;where('parent',$parent)
                    -&gt;where('order_id', '&lt;', $page-&gt;order_id)
                    -&gt;increment('order_id');
            }
            else
            {
                DB::table('pages')
                    -&gt;where('parent',$parent)
                    -&gt;where('order_id', '&gt;=', $page-&gt;order_id)
                    -&gt;decrement('order_id');
            }
        }
        else
        {
            DB::table('pages')
                -&gt;where('parent',$page-&gt;parent)
                -&gt;where('order_id', '&gt;', $page-&gt;order_id)
                -&gt;decrement('order_id');    
        }



    $page-&gt;order_id = Input::get('index');
    $page-&gt;parent = Input::get('parent');

    $page-&gt;save();

    return $id;
}
</code></pre>

<p>I'm making a sortable list, can anyone see a problem?</p>
