title: Use echo inside php one line if statement
body: <p>I use to write one line if statements combined with echo like this:</p>
  
  <pre><code>&lt;?php echo ( true ) ? 'true' : 'false'; ?&gt;
  </code></pre>
  
  <p>Today I did alter en existing multi line if statement and the <code>echo</code> ended up inside the statement, which gave me a parse error:</p>
  
  <pre><code>&lt;?php ( true ) ? echo 'true' :  echo 'false'; ?&gt;
  </code></pre>
  
  <p>Using <code>print</code> instead of <code>echo</code> makes it work, though. I figure that it works because <code>print</code> is a <em>function</em>. <strong>Update: <code>print</code> is not a function it just behaves like one, which means it has a return value.</strong> </p>
  
  <pre><code>&lt;?php ( true ) ? print 'true' :  print 'false'; ?&gt;
  </code></pre>
  
  <p>What I don't understand is the reason why echo doesn't work. As i understand is the above syntax just a shorthand for a common if statement, so this shouldn't be working either:</p>
  
  <pre><code>if (true) echo 'true'; else echo 'false';
  </code></pre>
  
  <p>But it does. Someone who knows?</p>