0
Well I’m creating a simple rating system. What I intend is that every 2 ratings he add a Star, with a maximum of 5 stars.
How do I do that? I’ve been doing this but, no kidding..
$star = "<li><a href='#'><i class='fa fa-star' aria-hidden='true'></i></a></li>";
$max_stars = 5;
$total_stars = $product_review / $max_stars * 1;
for($i=1;$i<=5;$i++) {
if($product_review >= $i) {
if($total_stars) {
echo $star;
}
}
}
And so, I created this but... I’m 100% confused.. because it does just that, I add 1 star to every 1 review... Did I make the right code?