If I have a textbox where a user can enter multiple emails, i.e.
test@test.com
test2@test2.com
email3@email3.com
How can I use PHP to separate each email into an array/object?
Is it possible to give the users the option to separate by ‘;’ or ‘,’ or a new line?
If you give the user a delimiter character, you can use
explode. For instance, using;:You could use
,or\n(new line) instead of;if you preferred.If you wanted to divide the string based on all these characters, use
preg_split:Example: