title: How to replace "if" statement with a ternary operator ( ? : )?
body: <p>Based on the examples <a href="http://davidwalsh.name/javascript-shorthand-if-else-examples" rel="noreferrer">from this page</a>, I wanted to convert the below <code>if</code> statement to a ternary operator.</p>
  <p>Working code using <code>if</code> statement:</p>
  <pre><code>if (!empty($address['street2'])) echo $address['street2'].'&lt;br /&gt;';
  </code></pre>
  <p>I am not sure how this should be written using a ternary operator so that the <code>echo</code> works only if <code>street2</code> exists in the array and is not an empty string.</p>