PHP stripos Function

What is stripos Function and how it is used in string?

Explanation

In PHP,This function is used to find position of first occurrence of a case-insensitive string.

Syntax:


stripos(haystack,needle,offset)

In the above syntax "haystack" is the string to be searched for "needle", "offset" specifies where to begin search.

Example :


<?php
echo stripos("Hi India!","I", "0");
?>
Result :

3

In the above example the "I" is searched in the string from the offset "o" since "I" is at the "3"rd postion its displayed.

PHP Topics


Ask Questions

Ask Question