3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = <<<FOO #Doc 1 ## #Doc1.1 #Doc 1.2 mine_sht : carftj ### 漢字漢字貔貅 (Random chinese symbols) tv: tee # # HI tvw: 9 #Inline doc #aa 9abaa: ahah #heuens FOO; preg_match_all('~^\s*(?:(\w+)\s*:.[^\r\n#]*([^\r\n]*#*)?)?(#*(?:[^\r\n]|[\r\n]#)*)~um', $data, $matches); ///print_r($matches); $doc = ""; foreach($matches[1] as $i => $m) { $s = preg_replace('/\s+/', '', $m); //Remove whitespace if (str_starts_with($s, "#") || empty($s)){ //Valid next comment line $doc .= $matches[3][$i] . PHP_EOL; //Adding comments //print("DOC LOG: " . $doc . PHP_EOL); //LOG DOC continue; } print("KEY: " . $m . "\nDOC: " . $doc . "\nIDOC: " . $matches[2][$i] . "\n"); print("--------------------------------------------------\n"); $doc = $matches[3][$i]; //print("OPEN: ". $m . "-CLOSED\n"); }
Output for git.master, git.master_jit, rfc.property-hooks
KEY: mine_sht DOC: #Doc 1 ## #Doc1.1 #Doc 1.2 IDOC: ### 漢字漢字貔貅 (Random chinese symbols) -------------------------------------------------- KEY: tv DOC: IDOC: # # HI -------------------------------------------------- KEY: tvw DOC: IDOC: #Inline doc -------------------------------------------------- KEY: 9abaa DOC: #aa IDOC: --------------------------------------------------

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