3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str1 = 'key1:val1;key2:val2;key3:val3'; $str2 = 'key1:val1;key2:val2;key3:val3;'; function to_arr($str){ $array = array(); preg_match_all('/(.*?):(.*?);/',$str,$matches); foreach($matches[1]as$key=>$val){ $array[$val] = $matches[2][$key]; } return($array); } $arr1 = to_arr($str1); $arr2 = to_arr($str2); print_r($arr1); print_r($arr2);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [key1] => val1 [key2] => val2 ) Array ( [key1] => val1 [key2] => val2 [key3] => val3 )

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.81 ms | 405 KiB | 5 Q