Using realfloat.php “rf()” function tu workaround php 7.3 echoing floats with “,” instead of “.” as a decimal separator

This commit is contained in:
pezcurrel 2023-12-28 14:52:00 +01:00
parent b147447b69
commit af958a194f

View file

@ -5,7 +5,9 @@ if (!defined('N')) {
exit(0);
}
$lc=localeconv();
require '../lib/fnum.php';
require '../lib/realfloat.php';
require '../lib/supplangs.php';
echo('</nav>
@ -55,7 +57,7 @@ while ($row=mysqli_fetch_assoc($res)) {
}
arsort($buf);
$hl='';
foreach($buf as $key=>$val) $hl.=$key.': '.fnum($val,0,$dlang).'; ';
foreach($buf as $key=>$val) $hl.=$key.': '.fnum($val,$lc,0).'; ';
$hl=_('Hits per language').': '.substr($hl,0,-2);
$hp=explode(';',$row['HitsPage']);
@ -66,14 +68,14 @@ while ($row=mysqli_fetch_assoc($res)) {
}
arsort($buf);
$hp='';
foreach($buf as $key=>$val) $hp.=$key.': '.fnum($val,0,$dlang).'; ';
foreach($buf as $key=>$val) $hp.=$key.': '.fnum($val,$lc,0).'; ';
$hp=_('Hits per page').': '.substr($hp,0,-2);
echo('<div class="info1st">'.gmdate('d/m/Y',$row['TS']).': '.fnum($row['Visits'],0,$dlang).' <span class="visitslab">'.sp($row['Visits'],_('visit'),_('visits')).'</span>, '.fnum($row['Hits'],0,$dlang).' <span class="hitslab">'.sp($row['Hits'],_('hit'),_('hits')).'</span></div>'.N);
echo('<div class="info1st">'.gmdate('d/m/Y',$row['TS']).': '.fnum($row['Visits'],$lc,0).' <span class="visitslab">'.sp($row['Visits'],_('visit'),_('visits')).'</span>, '.fnum($row['Hits'],$lc,0).' <span class="hitslab">'.sp($row['Hits'],_('hit'),_('hits')).'</span></div>'.N);
echo('<div class="info">'.$hl.'</div>'.N);
echo('<div class="info">'.$hp.'</div>'.N);
echo('<div class="visits" style="width:'.(100/$maxvisits*$row['Visits']).'%"></div>'.N);
echo('<div class="hits" style="width:'.(100/$maxhits*$row['Hits']).'%"></div>'.N);
echo('<div class="visits" style="width:'.rf($row['Visits']*100/$maxvisits).'%"></div>'.N);
echo('<div class="hits" style="width:'.rf($row['Hits']*100/$maxhits).'%"></div>'.N);
}
mysqli_close($link);