Jump to: navigation, search

Php strripos

From w3cyberlearnings

Contents

PHP function strripos

This function finds the position of the last occurrence of a case-insensitive string in a given string.

Syntax strripos

  • string: string input
  • find: string to find
  • startpos (optional): the start location to start finding
strripos(string,find, startpos);

Return

  • Found: return true and the found position.
  • Not found: return false.

Example 1

<?php

echo strripos("Girl's cute and lovely","cute");

?>	

Output

7

Example 2

<?php

$str1 = "Girl's cute and lovely";
$find = "and";
$findpos = strripos($str1, $find);
if ($findpos) {
    echo "Found '{$find}' within '{$str1}' at '{$findpos}'.<br/>";
} else {
    echo "Does not find anything";
}
?>

Output

Found 'and' within 'Girl's cute and lovely' at '12'.

Related Functions


Navigation
Web
SQL
MISC
References