There is a field with user comments that left feedback to the product; in the comments, in addition to the text, there is a number from 1 to 5 stored in the database. A question how to deduce this number by a cycle? Those. I want to ensure that, depending on the number, the required number of stars is drawn: the number 1 - 1 star, 2 - 2, etc. How to achieve this?
|
activeup to the number that a person has. And if you still want to do as you want. You will have a loop in the loop by asterisks. I do not see the problem to do this. Look on the Internet, a lot of scripts ranking, written in 5 lines, and with the stars - Vasily Barbashevecho str_repeat('<span class="fa fa-star"></span>', $value);IMHO .... without any cycles - Alexey Shimansky