I want to write some text Year: X | percentage: $percentage%, where X is based on the value contained in $year.
$year can be 2010, 2011... but also 0. In this case, we have to write the word "All"; otherwise, the year itself.
Year: 2011 | percentage: 2%    // case $year not 0
Year: All | percentage: 2%     // case $year == 0
This code seems very long for what is required:
echo "year: ";
if ($year==0)
     echo "All";
else
     echo $year;
echo " | Percentage: $percentage%";
So I wonder: how can we make this code shorter and clearer?
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.
 
     
     
    