3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $emails = str_replace(' ','','ben@wearejh.com, john@wearejh.com, mike@wearejh.com'); $recipientsArray = preg_grep('/[-0-9a-zA-Z.+_]+@[-0-9a-zA-Z.+_]+\.[a-zA-Z]+/', explode(',', $emails)); var_dump($recipientsArray);
based on FgpKl
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
array(3) { [0]=> string(15) "ben@wearejh.com" [1]=> string(16) "john@wearejh.com" [2]=> string(16) "mike@wearejh.com" }