Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
$total = ($origCount * $origRating) + $rating;
$number = $origCount + $count;
if ($number > 0) {
$origRating = $total / $number;
$origCount = $number;
return [$origRating, $origCount];
} else {
$origRating = 0;
$origCount = 0;
return [$origRating, $origCount];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment