私はこの同じコーディングをいくつかの方法で試してみましたが、どちらも機能しませんでした。予期しない?
public function getCalendarById($calendarId)
{
$calendarsList = $this->getCalendarsList();
if($calendarId == "1") {
return $this->getMergedCalendars();
} else {
return (array_key_exists($calendarId, $calendarsList) ? $calendarsList[$calendarId] : null);
} else {//******** error here ***********
return (array_key_exists($calendarId, $calendarsList) ? $this->holidayrize($calendarId) : null);
}
}
コメント行にエラーが発生します。それは予期しないT_ELSEと言われます
何がいいですか?
おそらく最初の 'else'は' else if'となるでしょう –
if(条件)... else if(別の条件)... else – rosco
'elseif'と条件が必要です –