性能主题:如果有多个||或开关情况


Performance topic: If with multiple || or switch case?

我有一个小脚本来根据用户的来源格式化价格。
我现在的问题是什么是更好的性能明智?

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, ',', '.');
        }
    }

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, ',', '.');
        }
    }

使用下面的链接了解更多信息似乎编译器在优化switch语句方面比if语句做得更好。Case vs If Else If:哪个更有效?