fork download
  1. <?php
  2.  
  3. $s = "andrew garfield invited as andrew@gomail.com or man@ohman.com";
  4. $res = array();
  5. preg_match_all('~\S+@\S+~', $s, $res);
  6. print_r($res);
Success #stdin #stdout 0.01s 52488KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Array
        (
            [0] => andrew@gomail.com
            [1] => man@ohman.com
        )

)