3v4l.org

run code in 300+ PHP versions simultaneously
<?php $seriesArray = array(1, 2, 3, 5, 7, 8, 11, 12, 15); $result = array(); $indx = 0; foreach($seriesArray as $key => $val){ $tmp = $seriesArray[$key]; $next = (isset($seriesArray[$key+1]))? $seriesArray[$key+1] : ''; if($next != ''){ if(!isset($result[$indx])) $result[$indx] = array(); if(($tmp+1) == $next ){ $result[$indx][] = $tmp; }else{ $result[$indx][] = $tmp; $indx++; } }else{ $result[$indx][] = $tmp; } } foreach($result as $key => $val){ echo "Series ".($key+1)." : ".implode(",",$result[$key])."\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
Series 1 : 1,2,3 Series 2 : 5 Series 3 : 7,8 Series 4 : 11,12 Series 5 : 15

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.85 ms | 401 KiB | 8 Q