Unexpected '\' ...?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Unexpected '\' ...?

Post by Steveo31 »

Some regex feyd gave me some time ago... works great except for the error:

Code: Select all

$output = preg_replace('|\[div](.*?)\[/div]|ise',"str_replace('<br />', null, "<div class='div_code'>".highlight_string('\\1',true)."</div>")", $row['body']); 
    echo nl2br($output);
Shows:

Code: Select all

if(isset($_POST['rememberme'])){
    setcookie(
Warning: Unexpected character in input: ''' (ASCII=92) state=1 in c:\phpdev\www\public\emun\local new\includes\content\code.php(96) : regexp code on line 8
"logged", ucwords($_POST['username']), time()+100000);
}
?>
Google came back without much. I tried echoing it stripslashes, addslashed, and all. Nada.

:?:
Post Reply