stripos() function in PHP()

PHPProgrammingServer Side Programming

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

Note − The function is case-insensitive.

Syntax

stripos(str, search, begin)

Parameters

  • str − The string to search in

  • search − The string to search

  • begin − Where to begin the search

Return

The stripos() function returns the position of the first occurrence of a string inside another string.

Example

The following is an example −

Live Demo

<?php
   echo stripos("Cricket is a sports!, Cricket is a religion","Cricket");
?>

Output

0
raja
Published on 17-Oct-2018 12:33:19
Advertisements