3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php print_r(verifyDate('1.1.2011')); echo ':::'; print_r(verifyDate(null)); 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 TQr1i
Output for 5.6.28, 7.0.20 - 7.2.0
DateTime Object ( [date] => 2011-01-01 13:54:53.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 7.0.6
DateTime Object ( [date] => 2011-01-01 19:49:42.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::03.05.2016
Output for 7.0.5
DateTime Object ( [date] => 2011-01-01 08:09:32.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::03.04.2016
Output for 7.0.4
DateTime Object ( [date] => 2011-01-01 20:03:35.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::10.03.2016
Output for 7.0.3
DateTime Object ( [date] => 2011-01-01 21:24:22.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::18.03.2016
Output for 7.0.2
DateTime Object ( [date] => 2011-01-01 03:38:09.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::23.03.2016
Output for 7.0.1
DateTime Object ( [date] => 2011-01-01 06:55:27.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::24.03.2016
Output for 7.0.0
DateTime Object ( [date] => 2011-01-01 08:50:08.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::27.03.2016
Output for 5.6.21
DateTime Object ( [date] => 2011-01-01 14:57:42.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::02.05.2016
Output for 5.6.20
DateTime Object ( [date] => 2011-01-01 07:10:38.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::10.04.2016
Output for 5.6.19
DateTime Object ( [date] => 2011-01-01 04:16:06.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::08.03.2016
Output for 5.6.18
DateTime Object ( [date] => 2011-01-01 13:06:15.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::15.03.2016
Output for 5.6.17
DateTime Object ( [date] => 2011-01-01 00:41:12.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::20.03.2016
Output for 5.6.16
DateTime Object ( [date] => 2011-01-01 09:39:12.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::28.03.2016
Output for 5.6.15
DateTime Object ( [date] => 2011-01-01 10:28:47.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::29.03.2016
Output for 5.6.14
DateTime Object ( [date] => 2011-01-01 12:18:51.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::02.04.2016
Output for 5.6.13
DateTime Object ( [date] => 2011-01-01 16:50:05.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::15.04.2016
Output for 5.6.12
DateTime Object ( [date] => 2011-01-01 07:16:48.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::20.04.2016
Output for 5.6.11
DateTime Object ( [date] => 2011-01-01 13:41:35.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::24.04.2016
Output for 5.6.10
DateTime Object ( [date] => 2011-01-01 15:45:29.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::25.04.2016
Output for 5.6.9
DateTime Object ( [date] => 2011-01-01 20:53:47.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::27.04.2016
Output for 5.6.8
DateTime Object ( [date] => 2011-01-01 05:42:56.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.04.2016
Output for 5.5.35
DateTime Object ( [date] => 2011-01-01 23:49:29.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::22.05.2016
Output for 5.5.34
DateTime Object ( [date] => 2011-01-01 09:22:02.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::11.04.2016
Output for 5.5.33
DateTime Object ( [date] => 2011-01-01 07:08:37.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::09.03.2016
Output for 5.5.32
DateTime Object ( [date] => 2011-01-01 16:57:17.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::17.03.2016
Output for 5.5.31
DateTime Object ( [date] => 2011-01-01 03:46:36.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::21.03.2016
Output for 5.5.30
DateTime Object ( [date] => 2011-01-01 12:21:36.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::01.04.2016
Output for 5.5.29
DateTime Object ( [date] => 2011-01-01 07:08:09.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::17.04.2016
Output for 5.5.28
DateTime Object ( [date] => 2011-01-01 10:32:42.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::21.04.2016
Output for 5.5.27
DateTime Object ( [date] => 2011-01-01 12:15:26.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::22.04.2016
Output for 5.5.26
DateTime Object ( [date] => 2011-01-01 18:26:04.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::26.04.2016
Output for 5.5.25
DateTime Object ( [date] => 2011-01-01 01:49:32.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::29.04.2016
Output for 5.5.24
DateTime Object ( [date] => 2011-01-01 08:00:36.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::24.05.2016
Output for 5.4.45
DateTime Object ( [date] => 2011-01-01 13:54:55.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.44
DateTime Object ( [date] => 2011-01-01 13:54:56.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.43
DateTime Object ( [date] => 2011-01-01 13:54:57.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:54:58.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.39 - 5.4.40
DateTime Object ( [date] => 2011-01-01 13:54:59.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.37 - 5.4.38
DateTime Object ( [date] => 2011-01-01 13:55:00.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:01.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.34
DateTime Object ( [date] => 2011-01-01 13:55:02.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.31 - 5.4.32
DateTime Object ( [date] => 2011-01-01 13:55:03.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.30
DateTime Object ( [date] => 2011-01-01 13:55:04.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.27 - 5.4.29
DateTime Object ( [date] => 2011-01-01 13:55:04 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.24 - 5.4.26
DateTime Object ( [date] => 2011-01-01 13:55:05 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.3.28, 5.4.20 - 5.4.23
DateTime Object ( [date] => 2011-01-01 13:55:06 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.3.27, 5.4.18 - 5.4.19
DateTime Object ( [date] => 2011-01-01 13:55:07 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.3.25 - 5.3.26, 5.4.15 - 5.4.17
DateTime Object ( [date] => 2011-01-01 13:55:08 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.3.21 - 5.3.24, 5.4.11 - 5.4.14
DateTime Object ( [date] => 2011-01-01 13:55:09 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.3.20, 5.4.10
DateTime Object ( [date] => 2011-01-01 13:55:10 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.3.29
DateTime Object ( [date] => 2011-01-01 13:55:03 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015