How can the functions strpos, substr, and strrchr be effectively used together in PHP to manipulate strings?

When using strpos, substr, and strrchr together in PHP to manipulate strings, you can first find the position of a specific substring using strpos, then extract a portion of the string using substr based on that position, and finally find the last occurrence of a character using strrchr within the extracted substring.

$string = "Hello, World!";
$substring = "World";
$position = strpos($string, $substring);

if ($position !== false) {
    $extracted = substr($string, $position);
    $lastOccurrence = strrchr($extracted, 'o');
    
    echo $lastOccurrence;
}