3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getQuarterEndingOf($month) { $quarterEndings = [ 1 => 'Mar', 2 => 'Mar', 3 => 'Mar', 4 => 'Jun', 5 => 'Jun', 6 => 'Jun', 7 => 'Sep', 8 => 'Sep', 9 => 'Sep', 10 => 'Dec', 11 => 'Dec', 12 => 'Dec', ]; $timeFormat = sprintf('%s %s', $quarterEndings[$month], date('Y') ); return new \DateTime($timeFormat); } for($m=1; $m <= 12; $m++) { var_dump(getQuarterEndingOf($m)); $d = new \DateTime(); var_dump($d->setDate(date('Y'), floor($m/3)*3,1)); echo '==='; }
Output for git.master
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-03-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2014-12-01 04:56:05.003862" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#2 (3) { ["date"]=> string(26) "2015-03-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2014-12-01 04:56:05.003912" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#1 (3) { ["date"]=> string(26) "2015-03-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2015-03-01 04:56:05.003942" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#2 (3) { ["date"]=> string(26) "2015-06-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-03-01 04:56:05.003982" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#1 (3) { ["date"]=> string(26) "2015-06-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2015-03-01 04:56:05.004019" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#2 (3) { ["date"]=> string(26) "2015-06-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-06-01 04:56:05.004053" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2015-06-01 04:56:05.004093" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#2 (3) { ["date"]=> string(26) "2015-09-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-06-01 04:56:05.004132" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-01 04:56:05.004161" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#2 (3) { ["date"]=> string(26) "2015-12-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-09-01 04:56:05.004190" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-01 04:56:05.004219" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#2 (3) { ["date"]=> string(26) "2015-12-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-12-01 04:56:05.004248" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===
Output for git.master_jit
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-03-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2014-12-01 04:56:05.003793" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#2 (3) { ["date"]=> string(26) "2015-03-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2014-12-01 04:56:05.003840" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#1 (3) { ["date"]=> string(26) "2015-03-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2015-03-01 04:56:05.003870" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#2 (3) { ["date"]=> string(26) "2015-06-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-03-01 04:56:05.003901" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#1 (3) { ["date"]=> string(26) "2015-06-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2015-03-01 04:56:05.003931" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#2 (3) { ["date"]=> string(26) "2015-06-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-06-01 04:56:05.003960" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2015-06-01 04:56:05.003990" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#2 (3) { ["date"]=> string(26) "2015-09-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-06-01 04:56:05.004019" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-01 04:56:05.004049" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#2 (3) { ["date"]=> string(26) "2015-12-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-09-01 04:56:05.004079" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-01 04:56:05.004108" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#2 (3) { ["date"]=> string(26) "2015-12-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-12-01 04:56:05.004159" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===
Output for rfc.property-hooks
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-03-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2014-12-01 04:56:05.004089" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#2 (3) { ["date"]=> string(26) "2015-03-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2014-12-01 04:56:05.004148" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#1 (3) { ["date"]=> string(26) "2015-03-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2015-03-01 04:56:05.004196" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#2 (3) { ["date"]=> string(26) "2015-06-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-03-01 04:56:05.004246" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#1 (3) { ["date"]=> string(26) "2015-06-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2015-03-01 04:56:05.004293" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#2 (3) { ["date"]=> string(26) "2015-06-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-06-01 04:56:05.004340" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2015-06-01 04:56:05.004388" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#2 (3) { ["date"]=> string(26) "2015-09-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-06-01 04:56:05.004435" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-01 04:56:05.004483" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#2 (3) { ["date"]=> string(26) "2015-12-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-09-01 04:56:05.004530" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-01 04:56:05.004578" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===object(DateTime)#2 (3) { ["date"]=> string(26) "2015-12-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-12-01 04:56:05.004625" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ===

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:
56.87 ms | 409 KiB | 8 Q