PHP strpos() FunctionThe strops() is in-built function of PHP. It is used to find the position of the first occurrence of a string inside another string or substring in a string. Syntax:
This function will help us to find the numeric position of the first occurrence of needle in the haystack string Note: The strops() function is case-sensitive and binary-safe.Example 1Output: First string is: Hello Php First string is: Hello Php javatpoint! By using 'strpos()' function: Example 2Output: First string is: Hello php First string is: Hello php javatpoint! By using 'strpos()' function:6 Example 3Output: The string 'Hello' was found in the string 'Hello PHP' and exists at position 0 See Also:strchr() : It is used to find the first occurrence of a string inside another string. stscroll() : It is locale based string comparison. strcmp() : It is binary safe string comparison. Reference: http://php.net/manual/en/function.strpos.php Next TopicPHP String |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India