3v4l.org

run code in 300+ PHP versions simultaneously
<?php function calculate_due($num_installment, $first_due_date = null, $days = 1){ $start = DateTime::createFromFormat('d/m/Y', $first_due_date); $end = DateTime::createFromFormat('d/m/Y', $first_due_date); $end->add(new DateInterval('P'.($num_installment * $days).'D')); $period = new DatePeriod( $start, new DateInterval('P'.$days.'D'), $end ); $return = []; foreach ($period as $date) { $return[] = $date->format('d/m/Y'); } return $return; } echo 'Calculates installments from an informed date<br/>'.PHP_EOL;; echo implode("\n", calculate_due(5, '10/10/2020', 20));
Output for git.master, git.master_jit, rfc.property-hooks
Calculates installments from an informed date<br/> 10/10/2020 30/10/2020 19/11/2020 09/12/2020 29/12/2020

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:
194.03 ms | 478 KiB | 5 Q