I would like to know if there is a way i can get php to check what the characters are after a certain character.
e.g. person inputs into a form: goats.com
i want to get all of the letters after the 'DOT' I would normally check for the 3 from the right but if someone has a different domain (.co.uk for instance) then this won't work.
so, can i run a check on inputed data that is after a DOT?
hope that makes sense.🙂
Thanks in advance, Hugh
To grab everything from the first occurence of the period to the end, use strchr()
Cgraz
substr(strchr($userInput, "."), 1);
This is assuming that they don't enter "www." at the beginning. If they do, then just remove it:
if (eregi("www.", $userInput)) { eregi_replace("www.", "", $userInput); } $tld = substr(strchr($userInput, "."), 1);
quality guys, cheers
fastest response ever ;-)