title: How to save a IF into a variable PHP
body: <p>How can I save this IF into a php variable ?</p>
  
  <pre><code>if ($precopromocao &gt; 0 ) 
      echo "&lt;span class='preco_s_promocao'&gt;".$preco."€&lt;/span&gt;&amp;nbsp;&lt;span class='preco_c_desconto'&gt;".$precopromocao."€&lt;/span&gt;";
          else
      echo $preco."€";        
  </code></pre>
  
  <p>I tried:</p>
  
  <pre><code>$precofinal = if ($precopromocao &gt; 0 ) 
      echo "&lt;span class='preco_s_promocao'&gt;".$preco."€&lt;/span&gt;&amp;nbsp;&lt;span class='preco_c_desconto'&gt;".$precopromocao."€&lt;/span&gt;";
          else
      echo $preco."€";        
  </code></pre>
  
  <p>But it doesn't work..</p>