3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "ukahfranklin@yahoo.com, abhishek.b@contecglobal.com, Ukah Franklin B , <<option1>>, <<<option2>>>, Okechukwu Second name\n Abuja Airport, abvairport@contecglobal.com, <<<this option2>>>\n accounts.abuja@contecglobal.com, Accounts Abuja \n dejiashiru@contecglobal.com, Adeji Ashiru "; $result=array(); $no=0; $var = explode("\n",$string); foreach($var as $v){ $w = preg_split('/[,;]/',$v); foreach($w as $l){ if(preg_match('/((?<option2>(<{3}.+>{3}))|(?<option1>(<{2}.+>{2}))|(?<email>([a-zA-Z0-9.!#$%&?+\/=?^_`{|}~-]+@{1}[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]{2,}){1,11}))|(?<name>([^<>@]{2,10}[\w\W])+))/', $l, $matches)){ if(!empty($matches['option2'])){$result[$no]['option2']=$matches['option2'];} if(!empty($matches['option1'])){$result[$no]['option1']=$matches['option1'];} if(!empty($matches['email'])){ $result[$no]['email']=$matches['email']; }elseif(!empty($matches['name'])){ $result[$no]['name']=$matches['name']; } } } $no++; } print("<pre>".print_r($result,true)."</pre>"); exit();
Output for git.master, git.master_jit, rfc.property-hooks
<pre>Array ( [0] => Array ( [email] => ukahfranklin@yahoo.com [name] => Okechukwu Second name [option1] => <<option1>> [option2] => <<<option2>>> ) [1] => Array ( [name] => abvairport [option2] => <<<this option2>>> ) [3] => Array ( [email] => accounts.abuja@contecglobal.com [name] => Accounts Abuja ) [5] => Array ( [email] => dejiashiru@contecglobal.com [name] => Adeji Ashiru ) ) </pre>

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