With
preg_match($pattern, $subject, $matches, PREG_OFFSET_CAPTURE);
is it possible to search a string in reverse? ie. return the position
preg_match does not support reverse searching because it is not neccessary.
You can create a RegExp that contains a greedy (that is default) lookahead that matches anything (like (?<=.*)stuff ). This way you should get the last occurence of your match.
detailed information from official documentation here: preg_match