Let's say i have a database entry like this:
video_id | likes | dislikes
654 5 12
What i want to do is to transform the number of likes and dislikes into a 5 stars rating for google rich snippets.
Do you have any ideas? Some code?
To get a rating between 1 and 5, you could do the following:
$rating = 1 + 4 * $likes / ($likes + $dislikes);
Remember to take special care of the case where there are no votes, though.