chantown Posted January 1, 2008 Share Posted January 1, 2008 Quick question , Let's say I have an email asdf@gmail.com I'd like to know if the last 3 extension is .com. If it's .com, then I do something... What is the simple PHP string funcction that lets me "checK" the last 3 letters? Quote Link to comment https://forums.phpfreaks.com/topic/83992-solved-what-is-the-string-function-that-is-like-substring/ Share on other sites More sharing options...
pocobueno1388 Posted January 1, 2008 Share Posted January 1, 2008 <?php $email = "email@gmail.com"; $ext = substr($email, -4); echo $ext; if ($ext == ".com"){ //do something } ?> Quote Link to comment https://forums.phpfreaks.com/topic/83992-solved-what-is-the-string-function-that-is-like-substring/#findComment-427413 Share on other sites More sharing options...
chantown Posted January 1, 2008 Author Share Posted January 1, 2008 great Quote Link to comment https://forums.phpfreaks.com/topic/83992-solved-what-is-the-string-function-that-is-like-substring/#findComment-427424 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.