3v4l.org

run code in 300+ PHP versions simultaneously
<?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; } } $date = new DateTime('2014-11-02'); $test = new appendiceHelper(1, $date); ?>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Fatal error: Uncaught TypeError: DateTime::__construct(): Argument #1 ($datetime) must be of type string, DateTime given in /in/daABS:14 Stack trace: #0 /in/daABS(14): DateTime->__construct(Object(DateTime)) #1 /in/daABS(67): appendiceHelper->__construct(1, Object(DateTime)) #2 {main} thrown in /in/daABS on line 14
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Fatal error: Uncaught TypeError: DateTime::__construct(): Argument #1 ($datetime) must be of type string, DateTime given in /in/daABS:14 Stack trace: #0 /in/daABS(14): DateTime->__construct(Object(DateTime)) #1 /in/daABS(67): appendiceHelper->__construct(1, Object(DateTime)) #2 {main} thrown in /in/daABS on line 14
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught TypeError: DateTime::__construct() expects parameter 1 to be string, object given in /in/daABS:14 Stack trace: #0 /in/daABS(14): DateTime->__construct(Object(DateTime)) #1 /in/daABS(67): appendiceHelper->__construct(1, Object(DateTime)) #2 {main} thrown in /in/daABS on line 14
Process exited with code 255.
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct() expects parameter 1 to be string, object given' in /in/daABS:14 Stack trace: #0 /in/daABS(14): DateTime->__construct(Object(DateTime)) #1 /in/daABS(67): appendiceHelper->__construct(1, Object(DateTime)) #2 {main} thrown in /in/daABS on line 14
Process exited with code 255.

preferences:
189.21 ms | 402 KiB | 229 Q