PHP – mb_strripos() function

PHPServer Side ProgrammingProgramming

The mb_strripos() function in PHP is used to search the last existing of a string in another string. This function is not case-sensitive. It performs multi-byte safe strripos() operation based on the number of characters. It returns the specified needle position count from the starting of the haystack string.


integer mb_strripos(


mb_strripos() accepts the following four parameters −

  • str_haystack − It is the string used to get the position of the last occurrence of the string needle.

  • str_needle − This is used to find the string from the haystack string.

  • integer_offset − This will the needle position in the haystack from where the search should start.

  • str_encoding − It is the character encoding name. If it is omitted, then internal encoding is used.

Return Values

This function returns the numeric position of the last occurrence of the needle in the given haystack string. It returns False if a needle is not found.


   //UTF-8 Encoding
   //String needle Wo
   //String Hello World
   $string = mb_strripos("Hello World","Wo",0, "UTF-8");



Updated on 12-Oct-2021 06:31:04