PHP strpos() string function

The strpos() function in PHP

The strpos() function used to searches the specific text in given string, if found then return start position of matches text, other wise returns false.

strpos() function syntax

strpos(“string”, “search string”);

PHP strpos() function example

echo "The strpos() answer = ". strpos("Hello Meera Academy","Meera");

The out put of strpos() is:

The strpos() answer = 6

The strpos() string function php from  example

<title>PHP strpos() Function</title>

<FORM method="POST" action="firstexample.php">

Name : <input type="text" name="name"> <br/>

<input type="submit" name="Submit1" value="String Position">


echo "The strpos() answer = ". strpos($_POST["name"],"Meera");


The php strpos() string function output is :

PHP strpos() string function
PHP strpos() string function

Leave a Reply

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