3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "HD Alcoa Earnings Soar; Outlook Stays Upbeat BY By James R. Hagerty and Matthew Day PD 12 July 2011 LP Alcoa Inc.'s profit more than doubled in the second quarter. The giant aluminum producer managed to meet analysts' forecasts. However, profits wereless than expected TD Licence this article via our website: http://example.com"; function headerSplit($input) { static $delimsExpr = '/^(HD|BY|PD|LP|TD)/m'; static $whiteExpr = '/\s+/'; $parts = preg_split($delimsExpr, $input, -1, PREG_SPLIT_DELIM_CAPTURE); $result = array(); for ($i = 0, $l = count($parts); $i < $l; $i += 2) { $result[$parts[$i++]] = preg_replace($whiteExpr, ' ', trim($parts[$i++])); } return $result; } var_dump(headerSplit($string));
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { [""]=> string(2) "HD" [" By James R. Hagerty and Matthew Day "]=> string(2) "PD" [" Alcoa Inc.'s profit more than doubled in the second quarter. The giant aluminum producer managed to meet analysts' forecasts. However, profits wereless than expected "]=> string(2) "TD" }

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:
52.34 ms | 401 KiB | 8 Q