preg-replace - syntax/insertion of code
Posted: Thu Jul 17, 2003 8:16 am
Tryin' to learn BBcode.
Using preg-replace.
I think my syntax of inserting the preg instruction is at fault
Error:Parse error: parse error, unexpected $ in /home/.sites/14/site467/web/pstore/add.php on line 13
Using preg-replace.
I think my syntax of inserting the preg instruction is at fault
Code: Select all
<?PHP
$data = file('news.dat);
$data = array_reverse($data);
foreach($data as $element) {
preg_replace("/\[img\](.+?)\[\/img\]/", "<img src=$1>", $pieces[2]);
$element = trim($element);
$pieces = explode("|", $element);
echo $pieces[2] . "<BR>" . "<b>Posted by " . $pieces[1] . " on " . $pieces[0] .
"</b> <BR><BR>". $1.;
}
?>