3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php date_default_timezone_set('Asia/Singapore'); define('LF', "\n"); define('DATE_FORMAT', 'Y-m-d H:i:s'); $end_date = new DateTime('today'); $end_date->modify('first day of next month'); $sumend_timestamp = $end_date->getTimestamp(); if ($emember_flag) : $intervalSpec = 'P3M'; else : $intervalSpec = 'P1Y'; endif; $upgrade_interval = new DateInterval($intervalSpec); $start_date = clone $end_date; $start_date->sub($upgrade_interval); $sumstart_timestamp = $start_date->getTimestamp(); echo date(DATE_FORMAT, $sumend_timestamp) . LF; echo date(DATE_FORMAT, $sumstart_timestamp) . LF;
Output for 5.3.3 - 7.1.0
Notice: Undefined variable: emember_flag in /in/TKr6V on line 11 2014-08-01 00:00:00 2013-08-01 00:00:00
Output for 5.3.0 - 5.3.2
Notice: Undefined variable: emember_flag in /in/TKr6V on line 11 2014-08-01 00:00:00 2012-08-01 00:00:00
Output for 5.2.13 - 5.2.17
Warning: DateTime::modify(): Failed to parse time string (first day of next month) at position 10 (o): The timezone could not be found in the database in /in/TKr6V on line 8 Fatal error: Call to undefined method DateTime::getTimestamp() in /in/TKr6V on line 9
Process exited with code 255.
Output for 5.2.0 - 5.2.12
Fatal error: Call to undefined method DateTime::getTimestamp() in /in/TKr6V on line 9
Process exited with code 255.
Output for 5.1.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/TKr6V on line 7
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined function date_default_timezone_set() in /in/TKr6V on line 2
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_VARIABLE in /in/TKr6V on line 19
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_VARIABLE in /in/TKr6V on line 19
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/TKr6V on line 19
Process exited with code 255.