How can you handle cases where the input string contains whitespace when searching for numbers?

When searching for numbers in a string that may contain whitespace, we can remove all whitespace characters from the input string before searching for numbers. This can be done using PHP's `preg_replace` function with a regular expression pattern to match any whitespace character. Once the whitespace is removed, we can then search for numbers in the cleaned string using a regular expression pattern as well.

$inputString = "There are 3 apples and 5 oranges";
$cleanedString = preg_replace('/\s+/', '', $inputString);
preg_match_all('/\d+/', $cleanedString, $numbers);

print_r($numbers[0]);