How can the description of the 3rd parameter in preg_replace be utilized effectively in PHP?

When using preg_replace in PHP, the third parameter is used to specify the subject string where the replacement should be made. This parameter allows you to target specific parts of the subject string for replacement, rather than replacing all occurrences. By utilizing this parameter effectively, you can control where the replacements occur within the subject string.

// Example of utilizing the third parameter in preg_replace
$subject = "The quick brown fox jumps over the lazy dog";
$pattern = "/brown/";
$replacement = "red";
$subject = preg_replace($pattern, $replacement, $subject, 1); // Only replace the first occurrence
echo $subject; // Output: "The quick red fox jumps over the lazy dog"