3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php date_default_timezone_set('America/New_York'); $date = new DateTime(); echo json_encode($date,JSON_FORCE_OBJECT); var_dump(json_last_error(), json_last_error_msg()); function check($name) { $o = new $name('now', new DateTimeZone('UTC')); echo json_encode($o); $s = serialize($o); echo json_encode($); var_dump(isset($o2->_date_time) === false); } check('DateTime'); class A extends DateTime {} check('A');
Output for 5.4.0 - 5.4.29
Parse error: syntax error, unexpected ')', expecting variable (T_VARIABLE) or '$' in /in/8g1fV on line 14
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected ')', expecting T_VARIABLE or '$' in /in/8g1fV on line 14
Process exited with code 255.