Make condition in one line? : <p>Usually I made the <code>if/else</code> condition like this:</p>

<pre><code>if(empty($data['key']))
{
    $err = "empty . $key ";
}
</code></pre>

<p>but I saw that there is the <a href="https://davidwalsh.name/php-shorthand-if-else-ternary-operators" rel="nofollow">ternary operator.</a></p>

<p>I really don't understand how this works.. Someone could show me an example? How can I convert this condition in the ternary logic?</p>
