I am creating a login and want to allow my users to login either by username or email. How would I check if a string contains a letter, in this case @ so I can handle it correctly. Would I use strstr or strpos? Thanks!
I am creating a login and want to allow my users to login either
Share
You can use either. Since the
@should not appear at the start, you don’t even need thestrposresult booleanization workaround.If you want to assert that it’s a valid email address, then also try