3v4l.org

run code in 300+ PHP versions simultaneously
<?php $myArray = array( 'a','b','c','title1','d','e','f','title2','g','h','title3','i','title4','j','k' ); foreach ($myArray as $v) { if (strpos($v, 'title') !== 0) { $batch[] = $v; } elseif (!empty($batch)) { $result[] = $batch; $batch = []; } } if (!empty($batch)) { $result[] = $batch; } var_export($result);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 0 => 'a', 1 => 'b', 2 => 'c', ), 1 => array ( 0 => 'd', 1 => 'e', 2 => 'f', ), 2 => array ( 0 => 'g', 1 => 'h', ), 3 => array ( 0 => 'i', ), 4 => array ( 0 => 'j', 1 => 'k', ), )

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:
44.64 ms | 2010 KiB | 4 Q