How can the strpos function be used to search for a specific substring within a string in PHP?
The strpos function in PHP can be used to search for a specific substring within a string. It returns the position of the first occurrence of the substring in the string, or false if the substring is not found. To use strpos, provide the string to search within as the first argument, and the substring to search for as the second argument.
$string = "Hello, World!";
$substring = "World";
if (strpos($string, $substring) !== false) {
echo "Substring found at position: " . strpos($string, $substring);
} else {
echo "Substring not found";
}