Home » PHP stripos() function

PHP stripos() function

by Online Tutorials Library

PHP stripos() Function

The stripos() is predefine function of PHP. It is used to find the position of the first occurrence of a string inside another string.

Note: This function is case-insensitive and binary safe.

Syntax:

Parameter Description Required/Optional
string Specify the string to search. Required.
find Specify he string to find. Required.
start Specify where to begin the search. Optional.

Example 1

Output:

0  

Example 2

Output:

Before stripos() function: PHP is My Fav Language  After using stripos(): 1  

Note: There is one whitespace when PHP start so ‘stripos() function is used to fiind the position of the first occurrence of “php” inside the string.

Reference:

http://php.net/manual/en/function.stripos.php

Next TopicPHP String

You may also like