3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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 5.4.0 - 5.4.13
Parse error: syntax error, unexpected '$e' (T_VARIABLE), expecting identifier (T_STRING) or namespace (T_NAMESPACE) or \\ (T_NS_SEPARATOR) in /in/Vitej on line 10
Process exited with code 255.
Output for 5.3.0 - 5.3.23
Parse error: syntax error, unexpected T_VARIABLE, expecting T_STRING or T_NAMESPACE or T_NS_SEPARATOR in /in/Vitej on line 10
Process exited with code 255.