• Have Any Question?
  • contact@eitworld.com

PHP strpos() Function

  • PHP strpos() function search for the required text in a string.
  • If a match is found, the function returns the character position of the first match. If no match is found, it will return FALSE.
  • The given example shows the use of PHP strpos() function:

<!DOCTYPE html>




echo strpos("www.eitworld.com", "world");

echo "<br>";

echo strpos("Popular Tutorial", "Tutorial");

echo "<br>";

echo strpos("PHP Tutorial", "PHP");






    In the above example:

  • In first string www.eitworld.com world is present at position 7 that’s why strpos() function returns 7.
  • In Second string Popular Tutorial Tutorial is present at position 8 that’s why strpos() function returns 8.
  • In Third string PHP TutorialPHP is present at position 0 that’s why strpos() function returns 0.

Real Time Web Analytics