Split email address into first name and last name

Just a little bit of code here, thought it would be useful to share.

If you’re ever working with a system that registers users and would like to know user’s names to personalise things a little, you’ll understand the frustration of people not co-operating in giving you their names!

These simple scripts, either Javascript or PHP, can be added on to your registration page and will let you pick up first names and surnames from email addresses.  Hope it helps!

Feel free to test out the code and see how you can make it work for you on JSFiddle, where there’s an easy to follow JavaScript example that shows how you can make form registration easy, or the online PHPtester website, where you can try out some custom PHP code.

Leave a Reply

Your email address will not be published. Required fields are marked *