How can a PHP function be used to search for an expression within a string using an if statement?

To search for an expression within a string using a PHP function and an if statement, you can use the `strpos()` function to check if the expression exists in the given string. If `strpos()` returns a value other than `false`, it means the expression is found in the string. You can then use an if statement to handle the logic based on whether the expression is found or not.

$string = "Hello, World!";
$expression = "Hello";

if(strpos($string, $expression) !== false) {
    echo "The expression '$expression' was found in the string.";
} else {
    echo "The expression '$expression' was not found in the string.";
}