active_year = $date != null ? date('Y', strtotime($date)) : date('Y'); $this->active_month = $date != null ? date('m', strtotime($date)) : date('m'); $this->active_day = $date != null ? date('d', strtotime($date)) : date('d'); } public function add_event($date, $days = 1, $class = '') { $class = $class ? $class : $class; $this->events[] = [$date, $days, $class]; } public function __toString() { $num_days = date('t', strtotime($this->active_day . '-' . $this->active_month . '-' . $this->active_year)); $days = [0 => 'Sun', 1 => 'Mon', 2 => 'Tue', 3 => 'Wed', 4 => 'Thu', 5 => 'Fri', 6 => 'Sat']; $first_day_of_week = array_search(date('D', strtotime($this->active_year . '-' . $this->active_month . '-1')), $days); $html = '