pointer >= $this->count) { $str = trim(fgets(STDIN)); $this->arr = explode(' ', $str); $this->count = count($this->arr); $this->pointer = 0; } $result = $this->arr[$this->pointer]; $this->pointer++; return $result; } /** * @return bool */ public function hasNext() { return $this->pointer < $this->count; } /** * @return int */ public function nextInt() { return (int)$this->next(); } /** * @return float */ public function nextDouble() { return (double)$this->next(); } } // 初期化 $sc = new Scanner(); $str = $sc->next(); $time = date('Y/m/d', strtotime('+2 day', strtotime($str))); echo $time . "\n";