- var_dump: documentation ( source)
- preg_match: documentation ( source)
- preg_quote: documentation ( source)
- preg_replace: documentation ( source)
- sprintf: documentation ( source)
<?php
$actual = 'There was an error performing the requested operation. Please try again or contact us for assistance.';
$text = 'There was an error performing the requested operation. Please try again or contact us for assistance.';
$actual = preg_replace('/\s+/u', ' ', $actual);
$regex = '/'.preg_quote($text, '/').'/ui';
$message = sprintf('The text "%s" appears in the text of this page, but it should not.', $text);
var_dump(!preg_match($regex, $actual));