strpos
Find the first occurrence of substrings in strings
strpos()
function finds where the string first appears in another string.
Note: strpos()
function is case sensitive.
Note: This function is binary safe.
stripos()
- Find where the string first appears in another string (case insensitive)strripos()
- Find the last occurrence of a string in another string (case insensitive)strrpos()
- Find the last occurrence of a string in another string (case sensitive)Find the first occurrence of "php" in the string:
<?php echo strpos ( "You love php, I love php too!" , "php" ) ; ?>
Try it yourself
strpos ( string , find , start )
parameter | describe |
---|---|
string | Required. Specifies the string to search. |
Find | Required. Specifies the string to be searched. |
start | Optional. Specify where to start the search. |