3v4l.org

run code in 300+ PHP versions simultaneously
<?php $parcelas = 15; $primeiroVencimento = DateTime::createFromFormat('Y-m-d', '2015-01-30'); $vencimentos = array(); for ($i = 0; $i < $parcelas; $i++) { $interval = new DateInterval("P{$i}M"); $date = clone $primeiroVencimento; $date->add($interval); if ($date->format('d') < 30) { $date->setDate($date->format('Y'), $date->format('m'), 1); } $vencimentos[] = $date->format('Y-m-d'); } var_dump($vencimentos);
Output for git.master, git.master_jit, rfc.property-hooks
array(15) { [0]=> string(10) "2015-01-30" [1]=> string(10) "2015-03-01" [2]=> string(10) "2015-03-30" [3]=> string(10) "2015-04-30" [4]=> string(10) "2015-05-30" [5]=> string(10) "2015-06-30" [6]=> string(10) "2015-07-30" [7]=> string(10) "2015-08-30" [8]=> string(10) "2015-09-30" [9]=> string(10) "2015-10-30" [10]=> string(10) "2015-11-30" [11]=> string(10) "2015-12-30" [12]=> string(10) "2016-01-30" [13]=> string(10) "2016-03-01" [14]=> string(10) "2016-03-30" }

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:
53.4 ms | 402 KiB | 8 Q