1
这正好12倍:如何优化很多if循环?
if (isset($this->month1)) {
array_push($monthly, "Month 1: " . $this->month1)
}
if (isset($this->month2)) {
array_push($monthly, "Month 2: " . $this->month2)
}
if (isset($this->month3)) {
array_push($monthly, "Month 3: " . $this->month3)
}
反正优化呢?
重构数组。 –