Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

strripos(3) [php man page]

STRRIPOS(3)								 1							       STRRIPOS(3)

strripos - Find the position of the last occurrence of a case-insensitive substring in a string

SYNOPSIS
int strripos (string $haystack, string $needle, [int $offset]) DESCRIPTION
Find the numeric position of the last occurrence of $needle in the $haystack string. Unlike the strrpos(3), strripos(3) is case-insensitive. PARAMETERS
o $haystack - The string to search in. o $needle - If $needle is not a string, it is converted to an integer and applied as the ordinal value of a character. o $offset - If specified, search will start this number of characters counted from the beginning of the string. If the value is negative, search will instead start from that many characters from the end of the string, searching backwards. RETURN VALUES
Returns the position where the needle exists relative to the beginnning of the $haystack string (independent of search direction or off- set). Also note that string positions start at 0, and not 1. Returns FALSE if the needle was not found. Warning This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Please read the section on Booleans for more information. Use the === operator for testing the return value of this function. EXAMPLES
Example #1 A simple strripos(3) example <?php $haystack = 'ababcd'; $needle = 'aB'; $pos = strripos($haystack, $needle); if ($pos === false) { echo "Sorry, we did not find ($needle) in ($haystack)"; } else { echo "Congratulations! "; echo "We found the last ($needle) in ($haystack) at position ($pos)"; } ?> The above example will output: Congratulations! We found the last (aB) in (ababcd) at position (2) SEE ALSO
strpos(3), stripos(3), strrpos(3), strrchr(3), stristr(3), substr(3). PHP Documentation Group STRRIPOS(3)

Check Out this Related Man Page

STRSTR(3)						   BSD Library Functions Manual 						 STRSTR(3)

NAME
strstr, strcasestr, strnstr -- locate a substring in a string LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <string.h> char * strstr(const char *haystack, const char *needle); char * strcasestr(const char *haystack, const char *needle); char * strnstr(const char *haystack, const char *needle, size_t len); #include <string.h> #include <xlocale.h> char * strcasestr_l(const char *haystack, const char *needle, locale_t loc); DESCRIPTION
The strstr() function locates the first occurrence of the null-terminated string needle in the null-terminated string haystack. The strcasestr() function is similar to strstr(), but ignores the case of both strings. The strnstr() function locates the first occurrence of the null-terminated string needle in the string haystack, where not more than len characters are searched. Characters that appear after a '' character are not searched. Since the strnstr() function is a FreeBSD specific API, it should only be used when portability is not a concern. While the strcasestr() function uses the current locale, the strcasestr_l() function may be passed a locale directly. See xlocale(3) for more information. RETURN VALUES
If needle is an empty string, haystack is returned; if needle occurs nowhere in haystack, NULL is returned; otherwise a pointer to the first character of the first occurrence of needle is returned. EXAMPLES
The following sets the pointer ptr to the "Bar Baz" portion of largestring: const char *largestring = "Foo Bar Baz"; const char *smallstring = "Bar"; char *ptr; ptr = strstr(largestring, smallstring); The following sets the pointer ptr to NULL, because only the first 4 characters of largestring are searched: const char *largestring = "Foo Bar Baz"; const char *smallstring = "Bar"; char *ptr; ptr = strnstr(largestring, smallstring, 4); SEE ALSO
memchr(3), memmem(3), strchr(3), strcspn(3), strpbrk(3), strrchr(3), strsep(3), strspn(3), strtok(3), wcsstr(3), xlocale(3) STANDARDS
The strstr() function conforms to ISO/IEC 9899:1990 (``ISO C90''). BSD
October 11, 2001 BSD
Man Page