On my leaderboard here: https://mgo.io/mgo3/leaderboard.php , I am calculating the win % of a clan via this code:
<td style="text-align: center;">
{% set total = leader['win'] + leader['loss'] %}
{% if total == 0 %}0{% else %}{{ (leader['win'] / total * 100)|e }}{% endif %}%
</td>
The bracketed text info EX: {{ leader['xxx']|e }} is being passed through a .php file here:
function getLeaders() {
global $dbh;
date_default_timezone_set('UTC');
$res = array();
$stmt = $dbh->prepare("SELECT id, name, wins, losses, cp FROM clans ORDER BY id ASC");
$stmt->execute();
while ($row = $stmt->fetch()) {
$clan_id = (int) $row['id'];
$clan_name = $row['name'];
$res[$clan_id] = array();
$res[$clan_id]['name'] = $clan_name;
$res[$clan_id]['rank'] = 0;
$res[$clan_id]['cp'] = $row['cp'];
$res[$clan_id]['win'] = $row['wins'];
$res[$clan_id]['loss'] = $row['losses'];
How would I shorten the percentage that is outputted from the formula to the tenth place? ex: 79.45653355% to 79.4%