Which predefined PHP function is used to find the position of the first occurrence of a substring?

  • strpos($string, $substring)
  • strfind($string, $substring)
  • strstrpos($string, $substring)
  • locate($substring, $string)
The correct option is 'strpos($string, $substring)'. It is used to find the position of the first occurrence of a substring within a string. The other options are incorrect functions.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *