3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php print_r(verifyDate('1.1.2011')); echo ':::'; print_r(verifyDate(2015)); echo ':::'; print_r(getMonth(null)); echo ':::'; print_r(getQuarter(null)); echo ':::'; print_r(dtf(' ')); function getMonth($d) { return dtf($d,'n'); } function getQuarter($d) { return ceil( getMonth($d) / 3); } function verifyDate($date) { return DateTime::createFromFormat('d.m.Y', $date); } function dtf($date, $format = 'd.m.Y'){ if($date){ $date = new DateTime($date); return $date->format($format); } }
based on jn6ev
Output for 5.6.28, 7.0.20 - 7.2.0
DateTime Object ( [date] => 2011-01-01 13:55:30.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 7.0.6
DateTime Object ( [date] => 2011-01-01 19:49:29.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::03.05.2016
Output for 7.0.5
DateTime Object ( [date] => 2011-01-01 08:09:35.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::03.04.2016
Output for 7.0.4
DateTime Object ( [date] => 2011-01-01 20:03:36.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::10.03.2016
Output for 7.0.3
DateTime Object ( [date] => 2011-01-01 21:24:23.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::18.03.2016
Output for 7.0.2
DateTime Object ( [date] => 2011-01-01 03:38:10.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::23.03.2016
Output for 7.0.1
DateTime Object ( [date] => 2011-01-01 06:55:28.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::24.03.2016
Output for 7.0.0
DateTime Object ( [date] => 2011-01-01 08:50:07.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::27.03.2016
Output for 5.6.21
DateTime Object ( [date] => 2011-01-01 14:57:36.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::02.05.2016
Output for 5.6.20
DateTime Object ( [date] => 2011-01-01 07:10:42.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::10.04.2016
Output for 5.6.19
DateTime Object ( [date] => 2011-01-01 04:16:07.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::08.03.2016
Output for 5.6.18
DateTime Object ( [date] => 2011-01-01 13:06:17.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::15.03.2016
Output for 5.6.17
DateTime Object ( [date] => 2011-01-01 00:41:14.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::20.03.2016
Output for 5.6.16
DateTime Object ( [date] => 2011-01-01 09:39:10.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::28.03.2016
Output for 5.6.15
DateTime Object ( [date] => 2011-01-01 10:28:53.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::29.03.2016
Output for 5.6.14
DateTime Object ( [date] => 2011-01-01 12:18:54.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::02.04.2016
Output for 5.6.13
DateTime Object ( [date] => 2011-01-01 16:50:08.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::15.04.2016
Output for 5.6.12
DateTime Object ( [date] => 2011-01-01 07:16:51.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::20.04.2016
Output for 5.6.11
DateTime Object ( [date] => 2011-01-01 13:41:29.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::24.04.2016
Output for 5.6.10
DateTime Object ( [date] => 2011-01-01 15:45:07.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::25.04.2016
Output for 5.6.9
DateTime Object ( [date] => 2011-01-01 20:53:41.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::27.04.2016
Output for 5.6.8
DateTime Object ( [date] => 2011-01-01 05:42:51.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.04.2016
Output for 5.5.35
DateTime Object ( [date] => 2011-01-01 23:49:09.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::22.05.2016
Output for 5.5.34
DateTime Object ( [date] => 2011-01-01 09:22:05.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::11.04.2016
Output for 5.5.33
DateTime Object ( [date] => 2011-01-01 07:08:38.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::09.03.2016
Output for 5.5.32
DateTime Object ( [date] => 2011-01-01 16:57:19.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::17.03.2016
Output for 5.5.31
DateTime Object ( [date] => 2011-01-01 03:46:37.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::21.03.2016
Output for 5.5.30
DateTime Object ( [date] => 2011-01-01 12:21:40.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::01.04.2016
Output for 5.5.29
DateTime Object ( [date] => 2011-01-01 07:08:12.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::17.04.2016
Output for 5.5.28
DateTime Object ( [date] => 2011-01-01 10:32:37.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::21.04.2016
Output for 5.5.27
DateTime Object ( [date] => 2011-01-01 12:15:21.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::22.04.2016
Output for 5.5.26
DateTime Object ( [date] => 2011-01-01 18:25:59.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::26.04.2016
Output for 5.5.25
DateTime Object ( [date] => 2011-01-01 01:49:26.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::29.04.2016
Output for 5.5.24
DateTime Object ( [date] => 2011-01-01 08:00:40.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::24.05.2016
Output for 5.4.45
DateTime Object ( [date] => 2011-01-01 13:55:33.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.44
DateTime Object ( [date] => 2011-01-01 13:55:34.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.43
DateTime Object ( [date] => 2011-01-01 13:55:35.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.41 - 5.4.42
DateTime Object ( [date] => 2011-01-01 13:55:36.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.40
DateTime Object ( [date] => 2011-01-01 13:55:37.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.38 - 5.4.39
DateTime Object ( [date] => 2011-01-01 13:55:38.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.37
DateTime Object ( [date] => 2011-01-01 13:55:39.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.35 - 5.4.36
DateTime Object ( [date] => 2011-01-01 13:55:40.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.34
DateTime Object ( [date] => 2011-01-01 13:55:41.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.32
DateTime Object ( [date] => 2011-01-01 13:55:42.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.30 - 5.4.31
DateTime Object ( [date] => 2011-01-01 13:55:43.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.29
DateTime Object ( [date] => 2011-01-01 13:55:43 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.26 - 5.4.28
DateTime Object ( [date] => 2011-01-01 13:55:44 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.25
DateTime Object ( [date] => 2011-01-01 13:55:45 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.3.28, 5.4.23 - 5.4.24
DateTime Object ( [date] => 2011-01-01 13:55:46 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.19 - 5.4.22
DateTime Object ( [date] => 2011-01-01 13:55:47 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.18
DateTime Object ( [date] => 2011-01-01 13:55:48 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.3.27, 5.4.16 - 5.4.17
DateTime Object ( [date] => 2011-01-01 13:55:49 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.3.24 - 5.3.26, 5.4.14 - 5.4.15
DateTime Object ( [date] => 2011-01-01 13:55:50 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.3.21 - 5.3.23, 5.4.12 - 5.4.13
DateTime Object ( [date] => 2011-01-01 13:55:51 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.3.20, 5.4.10 - 5.4.11
DateTime Object ( [date] => 2011-01-01 13:55:52 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.3.29
DateTime Object ( [date] => 2011-01-01 13:55:42 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015