I want to just get the left half of an email address ( the username
part of username@email.com
), so stripping the @ and any characters after it.>
Since nobody's used preg_match
yet:
user@email.com
[1] => user
[2] => @email.com
[3] => email.com
)
*/
echo $match[1]; // output: `user`
?>
Using an array means if you decide later that you want the email.com
part, you've already got it separated out and don't have to drastically change your method. :)