FANDOM


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

 <?php
  echo stripos("Find a string", "StRInG");
 ?>

Output Edit

7


Example 2: Using a variable and offset Edit

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

Output Edit

7


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.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.