title: PHP | Should I Assign Shorthand if Statement to a varible
body: <p>I'm using a shorthand if statement to validate if a value is assigned to a variable, my question is should I assign the statement to a variable, because it's working if I assigned it or not.</p>
  
  <p>statement not assigned to variable | working</p>
  
  <pre><code>!empty($name) ? $name : $name="";
  </code></pre>
  
  <p>statement assigned to variable | also working</p>
  
  <pre><code>$is_name = (!empty($name)) ? $name : $name="" ;
  </code></pre>
  
  <p>Both statements are working, but which one is correct or better to be used.</p>