Home Tutorial Php Phpbeginners The strpos() function


Share on Google+Share on Google+
The strpos() function
Posted on: February 1, 2011 at 12:00 AM
This section contains the detail about strpos() function in PHP.

The strpos() function

The strpos() function is used to find the availability of a sub string/string inside a string.

This function returns FALSE ,if the string or sub string provided is not found.

The syntax of the above method is given below :

strpos(string, find, start)

Here, string is the string in which we search sub string. The  find is the sub string or string which we search inside another string. The start is optional argument and it specifies where to begin the search.

The below example will give you a clear idea :

Example :

echo strpos("Hello PHP!","PHP");

Output :


Since index starts with 0 that is why it shows 6. As in normal counting it is at 7th place.


Related Tags for The strpos() function:

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: February 1, 2011

Recommend the tutorial

Advertisements Advertisements