strpos Function in PHP

What is strpos Function?

Explanation

The "strpos" function is used find the position of the first occurrence of a string.

Syntax:


strpos(string,char,start)

In the above syntax "string" specifies the string to be searched, "char" specifes the character to be searched for, "start" specifies where to begin search.

Example :


<?php
echo strpos("Hello! How Are You!","ow");
?>
Result :

8

In the above example the strpos() returns 8, as the searched character is first found at that location.

PHP Topics


Ask Questions

Ask Question