I need a help with replacing a word from a text file to a link using php
This is my code:
<?php
$search = 'google';
$lines = file('f.txt');
foreach($lines as $line)
{
if(strpos($line, $search) !== false)
echo $search."\n";
echo preg_replace('/google/', '<a href="http://www.google.com/'></a>',$lines);
}
}
?>