How can the use of anchors (^ and $) affect the outcome of a regular expression match in PHP?
Using anchors (^ and $) in a regular expression in PHP can affect the outcome of a match by specifying the start and end points of the string to be matched. The ^ anchor signifies the start of a string, while the $ anchor signifies the end of a string. This ensures that the pattern is matched only if it appears at the specified position in the string.
$string = "Hello World";
$pattern = "/^Hello$/";
if (preg_match($pattern, $string)) {
echo "Match found!";
} else {
echo "No match found.";
}