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:

ParameterDescriptionRequired/Optional
stringSpecify the string to search.Required.
findSpecify he string to find.Required.
startSpecify 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




Latest Courses