3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array_1 = array( 'apple'=>1,'banana'=>2,'coconut'=> 3); $array_2 = array( 'apple'=>2,'banana'=>3,'coconut'=> 4); foreach( $array_1 as $fruit => $num) { if(array_key_exists($fruit, $array_2)){ //check if key from array_1 exists in array_2 $final_array[] = array($fruit => $array_1[$fruit].','.$array_2[$fruit]); //concatenate values from shared key } } print_r ($final_array);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [apple] => 1,2 ) [1] => Array ( [banana] => 2,3 ) [2] => Array ( [coconut] => 3,4 ) )

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