String Searching Functions | |
---|---|
strchr() | |
This function is the same as strstr(). | |
strcspn() | |
int strcspn(string $sSearched, string $sForbidden, integer $iStart = 0, integer $iLength = infinite) | |
This function returns length of the string $sSearched that contains only the characters not in $sForbidden, starting at $iStart and continuing for $iLength characters. This version is case-sensitive. | |
Argument | Description |
string $sSearched | This is a string that will be searched. |
string $sForbidden | This string is the set of characters that we disallow inside $sSearched. |
integer $iStart | This starting position for the search. |
integer $iLength | This determines how many characters are searched. |
stripos() | |
int stripos(string $sSearched, string $sPattern, int $iInitial = 0) | |
This function returns the position of the first instance of $sPattern inside of $sSearched that comes after $iInitial. If no instance is found, the function returns FALSE. This version is case-insensitive. | |
Argument | Description |
string $sSearched | This is a string that will be searched. |
string $sPattern | This string is the pattern that we are searching for inside $sSearched. |
int $iInitial | This is the starting location of the search. A negative value can be used to start searching from the end of the string. |
stristr() | |
string stristr(string $sSearched, string $sPattern, bool $bReturnInitial = false) | |
This function returns portion of the string $sSearched from the point where $sPattern is found in it to the end. If $bReturnInitial is false, the function returns the portion before the pattern is found. If no instance is found, the function returns FALSE. This version is case-insensitive. | |
Argument | Description |
string $sSearched | This is a string that will be searched. |
string $sPattern | This string is the pattern that we are searching for inside $sSearched. |
bool $bReturnInitial | This determines whether the function returns the portion of the $sSearched before $sPattern or from $sPattern to the end. |
strpbrk() | |
string strpbrk(string $sSearched, string $sCharSet) | |
This function returns portion of the string $sSearched from the point where one of the characters in $sCharSet is found in it to the end. If no instance is found, the function returns FALSE. This version is case-sensitive. | |
Argument | Description |
string $sSearched | This is a string that will be searched. |
string $sCharSet | This string is the set of characters that we are searching for inside $sSearched. |
strpos() | |
int strpos(string $sSearched, string $sPattern, int $iInitial = 0) | |
This function returns the position of the first instance of $sPattern inside of $sSearched that comes after $iInitial. If no instance is found, the function returns FALSE. This version is case-sensitive. | |
Argument | Description |
string $sSearched | This is a string that will be searched. |
string $sPattern | This string is the pattern that wee are searching for inside $sSearched. |
int $iInitial | This is the starting location of the search. A negative value can be used to start searching from the end of the string. |
strrchr() | |
string strrchr(string $sSearched, string $sCharacter) | |
This function returns the portion of $sSearched from the first instance of $sCharacter to the end with the search starting at the end. If no instance is found, the function returns FALSE. This version is case-sensitive. | |
Argument | Description |
string $sSearched | This is a string that will be searched. |
string $sCharacter | This string is the character that we are searching for inside $sSearched. |
strripos() | |
int strripos(string $sSearched, string $sPattern, int $iInitial = 0) | |
This function returns the position of the last instance of $sPattern inside of $sSearched that comes after $iInitial. If no instance is found, the function returns FALSE. This version is case-insensitive. | |
Argument | Description |
string $sSearched | This is a string that will be searched. |
string $sPattern | This string is the pattern that we are searching for inside $sSearched. |
int $iInitial | This is the starting location of the search. A negative value can be used to start searching from the end of the string. |
strpos() | |
int strrpos(string $sSearched, string $sPattern, int $iInitial = 0) | |
This function returns the position of the last instance of $sPattern inside of $sSearched that comes after $iInitial. If no instance is found, the function returns FALSE. This version is case-sensitive. | |
Argument | Description |
string $sSearched | This is a string that will be searched. |
string $sPattern | This string is the pattern that we are searching for inside $sSearched. |
int $iInitial | This is the starting location of the search. A negative value can be used to start searching from the end of the string. |
strspn() | |
int strspn(string $sSearched, string $sCharSet, integer $iStart = 0, integer $iLength = infinite) | |
This function returns length of the string $sSearched that contains only the characters in $sCharSet, starting at $iStart and continuing for $iLength characters. This version is case-sensitive. | |
Argument | Description |
string $sSearched | This is a string that will be searched. |
string $sCharSet | This string is the set of characters that we are searching for inside $sSearched. |
integer $iStart | This starting position for the search. |
integer $iLength | This determines how many characters are searched. |
strstr() | |
string stristr(string $sSearched, string $sPattern, bool $bReturnInitial = false) | |
This function returns portion of the string $sSearched from the point where $sPattern is found in it to the end. If $bReturnInitial is false, the function returns the portion before the pattern is found. If no instance is found, the function returns FALSE. This version is case-sensitive. | |
Argument | Description |
string $sSearched | This is a string that will be searched. |
string $sPattern | This string is the pattern that we are searching for inside $sSearched. |
bool $bReturnInitial | This determines whether the function returns the portion of the $sSearched before $sPattern or from $sPattern to the end. |
substr_count() | |
int substr_count(string $sSearched, string $sPattern, integer $iStart = 0, integer $iLength = infinite) | |
This function returns number of times that $sPattern is found in the string $sSearched, starting at $iStart and continuing for $iLength characters. This version is case-sensitive. | |
Argument | Description |
string $sSearched | This is a string that will be searched. |
string $sPattern | This string is the pattern that we are searching for inside $sSearched. |
integer $iStart | This starting position for the search. This value can be negative to indicate a postion from the end. |
integer $iLength | This determines how many characters are searched. This value can be negative to indicate a search in the reverse direction. |
© 20072024 XoaX.net LLC. All rights reserved.