I am trying to REMOVE WORK OR HOME off the end of emails these emails:
dongoltz@mydomain.com HOME dongoltz@domains.comHOME dongoltz@mydomain.com WORK dongoltz@domains.comWORK
I am using this, but only works when there is a space. I tried rtrim function, but it's taking out stuff it shouldn't. I only want to take out HOME or WORK at the end of the email address.
if(strpos($email, ' ')){ $email = substr($email, 0, strpos($email, ' ')); }else{ $email = $row3["EMAIL"]; }
Easiest thing would be to check if the last 4 are WORK or HOME:
if(substr($email, -4) == 'HOME' || substr($email, -4) == 'WORK') $email = substr($email, 0, -4);
Then just trim the email variable and have that be that.
That fixed it, thank you.