How to display the found matches of preg_match function in PHP?
- by Eric
I am using the following to check if links exist on file.php:
$fopen = fopen('file.php', 'r');
$fread = fread($fopen, filesize('file.php'));
$pattern = "/^<a href=/i";
if (preg_match($pattern, $fread)) {
echo 'Match Found';
} else {
echo 'Match Not Found';
}
if I echo preg_match($pattern, $fread) I get a boolean value, not the…