try (there maybe typos but hopefully you get the idea)
switch ($star['id'])
{
case 1:
echo ' <li><a href="https://stackoverflow.com/questions/11331423/javascript:void(0)" title="1 star out of 5" class="one-star">1</a></li>
<li><a href="https://stackoverflow.com/questions/11331423/javascript:void(0)" title="1 star and a half out of 5" class="one-star-half">1.5</a></li>';
break;
case 2:
echo ' <li><a href="https://stackoverflow.com/questions/11331423/javascript:void(0)" title="2 stars out of 5" class="two-stars">2</a></li>
<li><a href="https://stackoverflow.com/questions/11331423/javascript:void(0)" title="2 star and a half out of 5" class="two-star-half">2.5</a></li> ']
break;
case 3:
echo ' <li><a href="https://stackoverflow.com/questions/11331423/javascript:void(0)" title="3 stars out of 5" class="three-stars">3</a></li>
<li><a href="https://stackoverflow.com/questions/11331423/javascript:void(0)" title="3 star and a half out of 5" class="three-star-half">3.5</a></li> ';
break;
case 4:
echo ' <li><a href="https://stackoverflow.com/questions/11331423/javascript:void(0)" title="4 stars out of 5" class="four-stars">4</a></li>
<li><a href="https://stackoverflow.com/questions/11331423/javascript:void(0)" title="4 star and a half out of 5" class="four-star-half">4.5</a></li> ';
break;
case 5:
echo ' <li><a href="https://stackoverflow.com/questions/11331423/javascript:void(0)" title="5 stars out of 5" class="five-stars">5</a></li> ';
break;
default :
echo 'No vote';
break;
}
2
solved Php echo , simple foreach issue