3v4l.org

run code in 300+ PHP versions simultaneously
<?php function convertDate($tz, $dt) { if ($tz != "default") { date_default_timezone_set($tz); $new_dt = new DateTime($dt, new DateTimeZone($tz)); return $new_dt->format("d-m-Y H:i:s"); } else { return $dt; } } var_dump(convertDate("America/New_York", "2016-11-31 23:59:58")); var_dump(convertDate("Europe/London", "2016-11-31 23:59:58")); var_dump(convertDate("default", "2016-11-31 23:59:58"));
Output for git.master, git.master_jit, rfc.property-hooks
string(19) "01-12-2016 23:59:58" string(19) "01-12-2016 23:59:58" string(19) "2016-11-31 23:59:58"

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
42.71 ms | 401 KiB | 8 Q