Finds the last occurrence of a string inside a string.

Arguments Edit

void strrpos ({{{params}}})

Argument Inclusion Edit

  • strrpos needs PHP version 4 or 5 to work.

Return values Edit

strrpos will return the numeric position of the last 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.

Examples Edit

Example 1: The direct way Edit

 echo strrpos("Find a string inside a string", "string");

Output Edit


Example 2: Using a variable and offset Edit

 $string = "abc abc abc";
 $find   = "a";
 echo strrpos($string, $find, 1); // Stars searching at the first b

Output Edit

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.