3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '[ { "1": "tag_es1;tag_es2;tag_es3", "2": "tag_en1;tag_en2;tag_en3" }, { "1": "tag_es1;tag_es2", "2": "tag_en1;tag_en2" } ]'; $arr = json_decode($json, true); foreach($arr as $key1 => $sub){ foreach($sub as $item){ $temp[] = explode(";", $item); } foreach($temp[0] as $key2 => $val){ $new[$key1][]= array_combine([1,2],array_column($temp, $key2)); } $temp =[]; } Var_dump($new);
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { [0]=> array(3) { [0]=> array(2) { [1]=> string(7) "tag_es1" [2]=> string(7) "tag_en1" } [1]=> array(2) { [1]=> string(7) "tag_es2" [2]=> string(7) "tag_en2" } [2]=> array(2) { [1]=> string(7) "tag_es3" [2]=> string(7) "tag_en3" } } [1]=> array(2) { [0]=> array(2) { [1]=> string(7) "tag_es1" [2]=> string(7) "tag_en1" } [1]=> array(2) { [1]=> string(7) "tag_es2" [2]=> string(7) "tag_en2" } } }

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:
147.86 ms | 407 KiB | 5 Q