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 :
<?php echo strpos("Hello PHP!","PHP"); ?>
Since index starts with 0 that is why it shows 6. As in normal counting it is at 7th place.
Posted on: February 1, 2011 If you enjoyed this post then why not add us on Google+? Add us to your Circles