please check the following:
$email = 'name@example.com';
$domain = strstr($email, '@');
echo $domain; // prints @example.com
Is there a way I can return @example without the .com?
So, basically I need to search a string for a set of characters which i DON’T know, which exist between a set of charaters I DO know.
So, in the following I want to return “dog”:
$string = “I used to have a pet dog named spot”;
I can get the last section of the string using:
$pet_type = strstr($string, 'pet ');
Is this possible?
or use 2 times explode
returns: example