Description Edit

stripos will return the numeric position of a case-insensitive search string inside the given string. Note that the position in string starts with 0 and not with 1. If the optional offset parameter was set it starts searching at the character with that number. The return value will still be relative to the beginning of the string.

Note: stripos may return boolean false, but may also return a non-boolean value which evaluates to false, like 0 or an empty string (""). Use the === operator for testing the return value of this function.

Parameters Edit

{{{returns}}} stripos (string input, string search [, integer offset])

Parameter Infos Edit

Parameter PHP Version Type
stripos 5 returns integer
input 5 string
search 5 string
offset 5 integer

Examples Edit

Example 1: The direct way Edit

  echo stripos("Find a string", "StRInG");

Output Edit


Example 2: Using a variable and offset Edit

  $string = "abcdef ABCDEF";
  $find   = "a";
  echo stripos($string, $find, 1); // Stars searching at the first b

Output Edit


See also Edit

strpos, strrpos, strrchr, substr, stristr, strstr, strripos, str_ireplace

For more details on this function, visit its entry in the php manual.