The strstr() function is used to find the first occurrence of a string, return the part of string
strstr ( string $string , mixed $search_string, bool $before_search = FALSE) : stringParameters
Parameter Name | Descrption |
---|---|
string | Required, string |
search_string | Required, if search_string is number, it is converted to an integer search for mathing character with the ASCII value of number. |
before_search | Optional, DEFAULT is FALSE if set TRUE then return the part of string before the first occurrence of the $before_search |
Returns the string, if search_string is not found return FALSE
$string_web = 'qoify.com'; echo $new_string = strstr($string_web,'.'); //Output:: .com echo $new_string = strstr($string_web,'.',TRUE); //Output:: qoify
Related Functions