<?phpclass Tarih{function isle($tarih, $islemler, $ne = FALSE, $miktar, $sonuc = FALSE){$hata = "<br>Uyarı! Tarih İşlemleri Başarısız ... ";if(!$tarih || !$islemler) {return "$hata geçersiz veya mevcut olmayan argümanlar<br>";}else{if(!($islemler == "cikar" || $islemler == "-" || $islemler == "topla" || $islemler == "+")) return "<br>$hata Geçersiz İşlem...<br>";else {list($gun, $ay, $yil) = explode("/", $tarih);($islemler == "cikar" || $islemler == "-") ? $islem = "-" : $islem = '';if($ne == "gun") $topla_gun = $islem."$miktar";if($ne == "ay") $topla_ay = $islem."$miktar";if($ne == "yil") $topla_yil = $islem."$miktar";$tarih = mktime(0, 0, 0, $ay + @$topla_ay, $gun + @$topla_gun, $yil + @$topla_yil);($sonuc == "timestamp" || $sonuc == "ts") ? $tarih = $tarih : $tarih = date("d/m/Y", "$tarih");return $tarih;}}}}$t = new Tarih;echo $tarih = $t->isle("26/05/2018", "topla", "gun", "4");echo "<br>";echo $tarih = $t->isle("26/05/2018", "cikar", "gun", "4");echo "<br>";echo $tarih = $t->isle("26/05/2018", "topla", "ay", "4");?>
Çıktı
30/05/201822/05/201826/09/2018