Jump to content

Recommended Posts

Hi there,

 

I have a script that works out ratings. Its based on a 1-10 scale with havles, for example 1, 1.5, 2, 2.5 etc.

 

What I want to do is display "stars" instead of actual numbers.

 

Is there a way I can do this using an if statement, for example if the rating is 7.5, display 4 stars?

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/275214-display-images-for-rating-system/
Share on other sites

toolman: What I would do, is to give each half of the star a value of 1, then round off your score to the nearest whole number.

Incidentally, that means that you will never display half a star for the .5, seeing as .5 is actually a quarter of a star. If you had 6.5 stars, on the other hand, it would round up to 7 and thus give you three and a half stars.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.