3v4l.org

run code in 300+ PHP versions simultaneously
<?php $selected_emails = array( 16781 => "xxx@gmail.com", 16782 => "yyy@gmail.com", 16785 => "xxx@gmail.com,yyy@gmail.com", 16789 => "yyy@gmail.com", 16751 => "xxx@gmail.com,yyy@gmail.com,zzz@gmail.com", 16729 => "zzz@gmail.com,bbb@gmail.com" ); $final_array = array(); foreach ($selected_emails as $newsletter => $emails) { foreach (explode(',', $emails) as $email) { $final_array[$email][] = $newsletter; } } var_dump($final_array);
Output for git.master, git.master_jit, rfc.property-hooks
array(4) { ["xxx@gmail.com"]=> array(3) { [0]=> int(16781) [1]=> int(16785) [2]=> int(16751) } ["yyy@gmail.com"]=> array(4) { [0]=> int(16782) [1]=> int(16785) [2]=> int(16789) [3]=> int(16751) } ["zzz@gmail.com"]=> array(2) { [0]=> int(16751) [1]=> int(16729) } ["bbb@gmail.com"]=> array(1) { [0]=> int(16729) } }

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