3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class CDateTime extends DateTime { public function __toString() { return $this->format('Y-m-d H:i'); } public function ConvertfromString( $date , $input , $output ) { $output = ""; $dt = $this->createFromFormat($input, $date ); $output = $dt->format( $output ); return ($output); } public function diff($now = 'NOW') { if ( !($now instanceOf DateTime) ) { $now = new DateTime($now); }; return parent::diff($now); } public function getAge($now = 'NOW') { return $this->diff($now)->format('%y'); } } ?>
based on WXoa8
Output for 7.0.0 - 7.0.2
Fatal error: Declaration of CDateTime::diff($now = 'NOW') must be compatible with DateTimeInterface::diff($object, $absolute = NULL) in /in/Yk9pV on line 34
Process exited with code 255.
Output for 5.5.24 - 5.6.17
Fatal error: Declaration of CDateTime::diff() must be compatible with DateTimeInterface::diff($object, $absolute = NULL) in /in/Yk9pV on line 34
Process exited with code 255.
Output for 5.4.11 - 5.4.45
Strict Standards: Declaration of CDateTime::diff() should be compatible with DateTime::diff($object, $absolute = NULL) in /in/Yk9pV on line 34
Output for 5.3.21 - 5.3.29
Strict Standards: Declaration of CDateTime::diff() should be compatible with that of DateTime::diff() in /in/Yk9pV on line 34