3v4l.org

run code in 300+ PHP versions simultaneously
<?php class DateTimeAttribute extends DateTime { private $datetime = ''; public function __construct($datetime) { try { parent::__construct($datetime); } catch (e) {} $this->datetime = $datetime; } public function __toString() { return $this->datetime; } } $x = new DateTimeAttribute('2013-04-01 2x40:06'); echo $x; echo "\n"; echo $x->format('Y s');
Output for 8.3.0 - 8.3.6
Fatal error: Uncaught DateMalformedStringException: Failed to parse time string (2013-04-01 2x40:06) at position 11 (2): Unexpected character in /in/fuTBL:9 Stack trace: #0 /in/fuTBL(9): DateTime->__construct('2013-04-01 2x40...') #1 /in/fuTBL(21): DateTimeAttribute->__construct('2013-04-01 2x40...') #2 {main} thrown in /in/fuTBL on line 9
Process exited with code 255.
Output for 8.1.23 - 8.1.28, 8.2.10 - 8.2.18
Fatal error: Uncaught Exception: Failed to parse time string (2013-04-01 2x40:06) at position 11 (2): Unexpected character in /in/fuTBL:9 Stack trace: #0 /in/fuTBL(9): DateTime->__construct('2013-04-01 2x40...') #1 /in/fuTBL(21): DateTimeAttribute->__construct('2013-04-01 2x40...') #2 {main} thrown in /in/fuTBL on line 9
Process exited with code 255.
Output for 5.4.0 - 5.4.13
Parse error: syntax error, unexpected ')', expecting variable (T_VARIABLE) in /in/qA0gC on line 10
Process exited with code 255.
Output for 5.3.0 - 5.3.23
Parse error: syntax error, unexpected ')', expecting T_VARIABLE in /in/qA0gC on line 10
Process exited with code 255.

preferences:
79.72 ms | 401 KiB | 65 Q