3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dates = array ( '0' => "2013-02-18 05:14:54", '1' => "2013-02-12 01:44:03", '2' => "2013-02-05 16:25:07", '3' => "2013-01-29 02:00:15", '4' => "2013-01-27 18:33:45" ); function closest($dates, $findate) { $newDates = array(); foreach($dates as $date) { $newDates[] = strtotime($date); } echo "<pre>"; print_r($newDates); echo "</pre>"; sort($newDates); foreach ($newDates as $key=>$a) { if ($a >= strtotime($findate)) return $key; } return $key; } $values = closest($dates, date('2013-01-28 14:11:16')); echo $values;
Output for git.master, git.master_jit, rfc.property-hooks
<pre>Array ( [0] => 1361160894 [1] => 1360629843 [2] => 1360077907 [3] => 1359421215 [4] => 1359308025 ) </pre>1

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:
62.33 ms | 401 KiB | 8 Q