The best practice for not null if statements
<p>I've been writing my "If this variable is not empty" statements like so:</p>

<pre><code>if ($var != '') {
// Yup
}
</code></pre>

<p>But I've asked if this is correct, it hasn't caused a problem for me. Here is the answer I found online:</p>

<pre><code>if (!($error == NULL)) {
/// Yup
}
</code></pre>

<p>This actually looks longer than my approach, but is it better? If so, why?</p>
