You could subtract the deaths from the kills, or you could do what I do. A kill is worth 3 points and a death is worth 1 point.
You'd probably have to store the number of kills and deaths in a database of some type and constantly keep an updated number for the ratio (kills/deaths and maybe rounded to the tenths place)
Define the word ratio, and you would find that you are looking for kills divided by deaths. So $kills / $deaths of course.
PHP: /** @param int $kills @param int $deaths @param int $digits default 3 decimal places @return string */function getKdRatio($kills, $deaths, $digits = 3){ if($deaths === 0) return "N/A"; $ratio = (string) round($kills / $deaths, $digits); return rtrim($ratio, " 0.");}