stripos() function in PHP()


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

Updated on: 30-Jul-2019

218 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements