3v4l.org

run code in 300+ PHP versions simultaneously
<?php $original = array ( array ("title" => "one", "color" => "blue" ), array ("title" => "two", "color" => "green" ) ); $merged = array(); $str = "000three000red0!000four000white0!000five000black0!"; $pat = "/\d+(\D+)\d+(\D+)\d!/um"; preg_match_all($pat, $str, $match); var_dump($match); $merged = $original; $i = 0; foreach($match[1] as $result) { $merged[] = array("title" => $match[1][$i], "color" => $match[2][$i]); } print_r($merged);
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { [0]=> array(3) { [0]=> string(16) "000three000red0!" [1]=> string(17) "000four000white0!" [2]=> string(17) "000five000black0!" } [1]=> array(3) { [0]=> string(5) "three" [1]=> string(4) "four" [2]=> string(4) "five" } [2]=> array(3) { [0]=> string(3) "red" [1]=> string(5) "white" [2]=> string(5) "black" } } Array ( [0] => Array ( [title] => one [color] => blue ) [1] => Array ( [title] => two [color] => green ) [2] => Array ( [title] => three [color] => red ) [3] => Array ( [title] => three [color] => red ) [4] => Array ( [title] => three [color] => red ) )

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:
46.5 ms | 403 KiB | 8 Q