PHP Programing language

strpos() Functions in PHP
Previous Home Next

stripos()

The stripos() function finds the position of the first occurrence of a string inside another string. stripos() function is case-insensitive.

Syntax:
stripos(string,find,start)

Example:

<?php
echo stripos("Hello India..!!, Gud Morning","Morning");
?>

 

Output:

21

strpos()

The strpos() function finds the position of the first occurrence of a string inside another string. strpos() function is case-sensitive.

Syntax:
strpos(string,find,start)

Example:

<?php
echo strpos("Gud Morning...!!, Gud morning India","morning");
?>

Output:

22

strripos()

The strripos() function finds the position of the last occurrence of a string inside another string.

Syntax:
strripos(string,find,start)

In above syntax, "string" specifies the string to search, "find" specifies the string to find and "start" specifies where to begin the search.

Example:

<?php
echo strripos("Hello India..!!, Gud Morning","Morning");
?>

Output:

21

strrpos()

The strrpos() function finds the position of the last occurrence of a string inside another string.

Syntax:
strrpos(string,find,start)

In above syntax, "string" specifies the string to search, "find" specifies the string to find and "start" specifies where to begin the search.

Example:

<?php
echo strrpos("Gud Morning...!!, Gud morning India","morning");
?>

Output:

22

Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: