English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Basic PHP Tutorial

Advanced PHP Tutorial

PHP & MySQL

PHP Reference Manual

PHP stripos() Function Usage and Example

    PHP String Manual of String Functions

    The stripos() function is used to find the first occurrence position of a string (not case-sensitive).

Syntax

stripos(string,find,start)

Definition and Usage

It is used to find the first occurrence position of a string in another string

Related Functions:

  • strripos() - Find the last occurrence position of the string in another string (not case-sensitive)

  • strpos() - Find the first occurrence position of the string in another string (case-sensitive)

  • strrpos() - Find the last occurrence position of the string in another string (case-sensitive)

Return Value

Returns the position of the first occurrence of a string in another string. If the string is not found, it returns FALSE. Note: The string position starts from 0, not from 1 Start.

Parameter

Serial NumberParameters and Description
1

string

Used for string search

2

find

Used to specify the string to be searched

3

start

It specifies where to start the search

Online Example

Try the following example, search for 'w'3The first occurrence position of 'codebox' in the string

<?php
   //Search for the string 'w'3The first occurrence position of 'codebox'
   echo stripos("www.oldtoolbag.com","w3codebox");
?>
Test and see‹/›

Output Result

4

PHP String Manual of String Functions