When intoducing an array my str_replace function seems to have stopped working:
Code: Select all
<?PHP
$data = file('news.dat');
{
$arrayFiles = implode($data, $fin);
$string = "$data";
$pattern = '!/\\[img\\](.+?)\\[\\/img\\]/!i, !/\[URL=(.*?)\](.*)\[\/URL\]/i';
$replacement = '!<img src="\\1">!, !<a class="link3" //href="http://\\1">\\2</a>!';
$fin= str_replace($pattern, $replacement, $string);
print $arrayFiles;
}
?>all is printed to the screen,
except the [img] and [ url ] str_replacement has not worked.
Does anybody know why?