3v4l.org

run code in 300+ PHP versions simultaneously
<?php $keys = ["1","2","3","4-1","99","1","2","3","4-1","4-2","4-3","99","1","2","3","4-1","4-2","99"]; $values = ["a","b","c","d","x","a1","b1","c1","d1","e","g","x","a2","b2","c2","d2","e","x"]; $new_array = array(); $split_at = "99"; $i = 0; foreach ($keys as $key => $value) { $new_array[$i][$value] =$values[$key]; if($split_at == $value){ $i++; } } print_r($new_array);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [1] => a [2] => b [3] => c [4-1] => d [99] => x ) [1] => Array ( [1] => a1 [2] => b1 [3] => c1 [4-1] => d1 [4-2] => e [4-3] => g [99] => x ) [2] => Array ( [1] => a2 [2] => b2 [3] => c2 [4-1] => d2 [4-2] => e [99] => x ) )

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:
34.67 ms | 402 KiB | 8 Q