I have a small script to format the prices depending on the origin of the user.
My question now is what is better performance wise?
function FormatPrice($Price) {
$Locale = $this->Locale;
switch ($Locale) {
case "en-GB":
case "en-IE":
case "he-IL":
case "mt-MT":
case "zh-CN":
return number_format($Price, 2, '.', ',');
default:
return number_format($Price, 2, ',', '.');
}
}
or
function FormatPrice($Price) {
$Locale = $this->Locale;
if ($Locale === "en-GB" || $Locale === "en-IE" || $Locale === "he-IL" || $Locale === "mt-MT" || $Locale === "zh-CN") {
return number_format($Price, 2, '.', ',');
} else {
return number_format($Price, 2, ',', '.');
}
}
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire