3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arr = ['12:00am','12:15am','12:30am','12:45am','1:00am','1:15am','1:30am','1:45am','2:00am','3:15am','3:30am','3:45am','4:00am','1:00pm','1:15pm','1:30pm']; $new = []; $temp = []; $total = count($arr); for($i=0; $i< $total;$i++){ $k = $i+1; if(isset($arr[$k]) && strtotime($arr[$k]) - strtotime($arr[$i]) == 900){ $temp[] = $arr[$i]; }else{ $temp[] = $arr[$i]; $new[] = $temp; $temp = []; } } print_r($new);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [0] => 12:00am [1] => 12:15am [2] => 12:30am [3] => 12:45am [4] => 1:00am [5] => 1:15am [6] => 1:30am [7] => 1:45am [8] => 2:00am ) [1] => Array ( [0] => 3:15am [1] => 3:30am [2] => 3:45am [3] => 4:00am ) [2] => Array ( [0] => 1:00pm [1] => 1:15pm [2] => 1:30pm ) )

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:
48.38 ms | 1620 KiB | 4 Q