- strrpos: documentation ( source)
<?php
$str = "Hello this is dummy.test. in this string
any character, any special character can appear. it is not a fixed type
text and predefined. this string will not read manually check by the
Programmer.Sorry for the bad English.";
$test = strrpos($str, 'test');
$dummy = strrpos($str, 'dummy', strlen($str) - $test);
echo $dummy;