title: If-else statement in just one line for simple text
body: <p>I want to write some text <code>Year: X | percentage: $percentage%</code>, where <code>X</code> is based on the value contained in <code>$year</code>.</p>
  
  <p><code>$year</code> can be <code>2010</code>, <code>2011</code>... but also <code>0</code>. In this case, we have to write the word <code>"All"</code>; otherwise, the year itself.</p>
  
  <pre><code>Year: 2011 | percentage: 2%    // case $year not 0
  Year: All | percentage: 2%     // case $year == 0
  </code></pre>
  
  <p>This code seems very long for what is required:</p>
  
  <pre><code>echo "year: ";
  if ($year==0)
       echo "All";
  else
       echo $year;
  
  echo " | Percentage: $percentage%";
  </code></pre>
  
  <p>So I wonder: how can we make this code shorter and clearer?</p>
  
  <p><sub>Note I posted my own answer because I wanted to share the way I found after spending some time working on it. Anyway, I see there are other ones that look quite good.</sub></p>