3v4l.org

run code in 500+ PHP versions simultaneously
<?php $text = '[HEAD] [TITLE-MAIN] example news1 [TITLE-SUB] title sub1 [CONTENT] content text1 [HEAD] [TITLE-MAIN] example news2 [TITLE-SUB] title sub2 [CONTENT] content text2'; $sections = array(); foreach (preg_split('/\s*\[HEAD\]\s*/', $text, -1, PREG_SPLIT_NO_EMPTY) as $section) { $s = trim($section); $tag_data = preg_split('/\[([^\]]+)\]/', $s, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); for ($i = 0; $i < count($tag_data); $i += 2) { $tags[$tag_data[$i]] = trim($tag_data[$i+1]); } $sections[] = $tags; } print_r($sections);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [TITLE-MAIN] => example news1 [TITLE-SUB] => title sub1 [CONTENT] => content text1 ) [1] => Array ( [TITLE-MAIN] => example news2 [TITLE-SUB] => title sub2 [CONTENT] => content text2 ) )

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:
39.77 ms | 1549 KiB | 4 Q