3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fileContents = <<<TEXT #################### Section One #################### Data A Data B #################### Section Two #################### Data C Data D Data E #################### Section Three #################### Data F TEXT; preg_match_all( '~(?: ^\#{3,}\R \h*(\S+(?:\h\S+)*)\h*\R \#{3,} | \G(?!\A) ) \R (?!\#{3,})(.+) ~mx', $fileContents, $out, PREG_SET_ORDER ); foreach ($out as $set) { $heading = $set[1] ?: $heading; $result[$heading][] = $set[2]; } var_export($result ?? 'No qualifying data');
Output for git.master, git.master_jit, rfc.property-hooks
array ( 'Section One' => array ( 0 => 'Data A', 1 => 'Data B', ), 'Section Two' => array ( 0 => 'Data C', 1 => 'Data D', 2 => 'Data E', ), 'Section Three' => array ( 0 => 'Data F', ), )

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:
164.73 ms | 406 KiB | 5 Q