3v4l.org

run code in 300+ PHP versions simultaneously
<?php /*Bugünkü Zamandan Önce Bir Tarih Girilirse Kaç Gün Geçtiğini, Bugünkü Zamandan Sonra Bir Tarih Girilirse Ne Kadar Kaldığığını Verir... http://abgsatman.com */ define("SANIYE",1); define("DAKIKA_SN",60*SANIYE); define("SAAT_SN",60*DAKIKA_SN); define("GUN_SN",24*SAAT_SN); class KalanZaman { var $snfark,$gun,$saat,$dakika,$saniye; var $durum="Var"; function KalanZaman($g) { $this->hesapla($g); } function hesapla($v) { $this->snfark = strtotime($v)-time(); if($this->snfark<0) { $this->snfark *= (-1); $this->durum = "Geçti"; } $this->gun = floor($this->snfark/GUN_SN); $this->snfark -= $this->gun*GUN_SN; $this->saat = floor($this->snfark/SAAT_SN); $this->snfark -= $this->saat*SAAT_SN; $this->dakika = floor($this->snfark/DAKIKA_SN); $this->snfark -= $this->dakika*DAKIKA_SN; $this->saniye = $this->snfark; } function rString() { $retVal = ""; if($this->gun!=0) $retVal .= $this->gun." Gün "; if($this->saat!=0) $retVal .=$this->saat." Saat "; if($this->dakika!=0) $retVal .=$this->dakika." Dakika "; if($this->saniye!=0) $retVal .=$this->saniye." Saniye"; return $retVal." ".$this->durum; } } $girilen_zaman = "2005-06-10 10:00:00"; $kalan_zaman = new KalanZaman("$girilen_zaman"); //Girilen Değerler MySQL datetime Formatıdır. :) echo "Girilen Zaman :$girilen_zaman<br>"; echo $kalan_zaman->rString(); ?>
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.26, 7.3.0 - 7.3.13, 7.4.0 - 7.4.1
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; KalanZaman has a deprecated constructor in /in/2nmkp on line 11 Girilen Zaman :2005-06-10 10:00:00<br>3409 Gün 13 Saat 48 Dakika 49 Saniye Geçti
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.1.3 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.29, 5.4.32 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Girilen Zaman :2005-06-10 10:00:00<br>3409 Gün 13 Saat 48 Dakika 49 Saniye Geçti
Output for 5.4.30 - 5.4.31
Girilen Zaman :2005-06-10 10:00:00<br>3409 Gün 13 Saat 48 Dakika 50 Saniye Geçti
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.2
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/2nmkp on line 12 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/2nmkp on line 13 Girilen Zaman :2005-06-10 10:00:00<br>3409 Gün 13 Saat 48 Dakika 49 Saniye Geçti

preferences:
250.76 ms | 402 KiB | 325 Q