What is the correct way to use the strpos function in PHP to search for a specific date in a text string?

When using the strpos function in PHP to search for a specific date in a text string, you need to ensure that the date format matches the format in the text string. If the date in the text string is in a specific format (e.g., "YYYY-MM-DD"), you should search for the date in the same format. Additionally, you should handle cases where the date may not be found in the text string by checking the return value of strpos.

$text = "Today is 2022-10-15";
$dateToSearch = "2022-10-15";

if(strpos($text, $dateToSearch) !== false) {
    echo "Date found in text!";
} else {
    echo "Date not found in text.";
}