3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class appendiceHelper { public $document; public $documentDealer; public $documentDate; public $Luglio2015; public $Ottobre2015; public $special; public function __construct($dealer,$date) { $this->documentDealer = $dealer; $this->documentDate = new DateTime($date); $this->document = "pdf/appendice_EM.pdf"; $this->special = 0; $this->IsSpecial(); $this->Luglio2015 = new DateTime(); $this->Luglio2015->setDate(2015, 7, 1); $this->Luglio2015->setTime(00, 01); $this->Ottobre2015 = new DateTime(); $this->Ottobre2015->setDate(2015, 10, 1); $this->Ottobre2015->setTime(00, 01); } private function IsSpecial() { //Dealer Stracciari - Authos if ($this->documentDealer == 882) $this->special = 1; if ($this->documentDealer == 1821) $this->special = 1; if ($this->documentDealer == 2633) $this->special = 1; if ($this->documentDealer == 3194) $this->special = 1; if ($this->documentDealer == 3206) $this->special = 1; if ($this->documentDealer == 3210) $this->special = 1; if ($this->documentDealer == 3218) $this->special = 1; if ($this->documentDealer == 3223) $this->special = 1; } public function getDocument() { $this->document = "pdf/app_cert_4.pdf"; $intervalLuglio2015 = $this->Luglio2015->diff($this->documentDate)->invert; $intervalOttobre2015 = $this->Ottobre2015->diff($this->documentDate)->invert; if($intervalOttobre2015 == 1) $this->document = "pdf/app_cert_2.pdf"; if($intervalLuglio2015 == 1) $this->document = "pdf/app_cert_1.pdf"; if($this->special == 1) { $this->document = "pdf/app_cert_5_special.pdf"; if($intervalOttobre2015 == 1) $this->document = "pdf/app_cert_3_special.pdf"; if($intervalLuglio2015 == 1) $this->document = "pdf/app_cert_1.pdf"; } return $this->document; } } $test = new appendiceHelper(1, new DateTime()) ?>
based on VHdEj
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught TypeError: DateTime::__construct() expects parameter 1 to be string, object given in /in/iiYSS:14 Stack trace: #0 /in/iiYSS(14): DateTime->__construct(Object(DateTime)) #1 /in/iiYSS(66): appendiceHelper->__construct(1, Object(DateTime)) #2 {main} thrown in /in/iiYSS on line 14
Process exited with code 255.
Output for 5.3.20 - 5.6.28
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct() expects parameter 1 to be string, object given' in /in/iiYSS:14 Stack trace: #0 /in/iiYSS(14): DateTime->__construct(Object(DateTime)) #1 /in/iiYSS(66): appendiceHelper->__construct(1, Object(DateTime)) #2 {main} thrown in /in/iiYSS on line 14
Process exited with code 255.