Latest web development tutorials

PHP stripos () function

PHP String Reference PHP String Reference

Examples

Find "php" in the position of the first occurrence of the string:

<?php
echo stripos("I love php, I love php too!","PHP");
?>

Running instance »

Definition and Usage

stripos () function to find the position of a string in another string of the first occurrence (case insensitive).

Note: stripos () function is not case-sensitive.

Note: This function is binary safe.

Related functions:

  • strripos () - Find the position of a string in another string of the last occurrence (case insensitive)
  • strpos () - Find the string in another string of the first occurrence (case-sensitive)
  • strrpos () - Find the string in another string of the last occurrence (case-sensitive)

grammar

stripos( string,find,start )

参数 描述
string 必需。规定被搜索的字符串。
find 必需。规定要查找的字符。
start 可选。规定开始搜索的位置。

technical details

return value: Returns the string in another string of the first occurrence of the string if not found returns FALSE. Note: The position of the string starting from 0, not 1.
PHP version: 5+


PHP String Reference PHP String Reference