

The following example uses the strpos() function to search for the substring 'do' in the string 'To do or not to do' start from the index 5: 3 Code language: PHP ( php ) 2) Using PHP strpos() function to search for a substring with an offset example The following example uses the strpos() function to search for the substring 'to' in the string 'To do or not to do':
If $offset is positive, the strpos() function starts the search at $offset number of characters to the end of the string. The $offset is an integer that represents the index at which the strpos() function starts the search.

#Php substring extract how to#
Summary: in this tutorial, you’ll learn how to use the PHP strpos() function to get the index of the first occurrence of a substring in a string.
