strpos

int strpos(string string, mixed substring, [int offset]) 

Finds the first position of a substring within a string.

Returns:

Integer; FALSE if the substring is not found

Description:

strpos() returns the position of the first occurrence of substring within string. If the optional offset parameter is specified, the function starts looking for substring after the specified offset.

If substring is not found, the function returns FALSE.

If the character parameter is not a string, it’s converted to an integer. The resulting integer is used as the ordinal value of a character.

Version:

PHP 3+, PHP 4+

See also:

Other functions that find characters within strings:

substr() 
strchr() 
stristr() 
strrpos() 
strstr() 

Example:

Example 32.43. Example ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.