switch($_SERVER["SCRIPT_NAME"]){
case "/index.php":
$this->pageId = 1;
break;
case "/shops/index.php":
$this->pageId = 2;
break;
case "/shops/dailydeals.php":
$this->pageId = 4;
break;
case "/shops/shops.php":
$this->pageId = 5;
break;
case "/shops/deals.php":
$this->pageId = 9;
break;
case "/shops/store.php":
$this->pageId = 10;
break;
case "/user/cashmail.php":
$this->pageId = 13;
break;
case "/user/cashmail.php":
$this->pageId = 13;
break;
default ;
$this->pageId = 1;
break;
}
上記のコードについてどう思いますか? case
腕に中括弧を使用するかどうかを決定しようとしています。この例の各ケースには 1 行のコードしかないため、中かっこは使用していません。中括弧を使用する場合と使用しない場合でパフォーマンスに違いはありますか?