note 56248 added to function.highlight-string

From: Date: Sun, 28 Aug 2005 18:19:02 +0000
Subject: note 56248 added to function.highlight-string
Groups: php.notes 
Request: Send a blank email to php-notes+get-94304@lists.php.net to get a copy of this message
on the code you ave a few errors: Error:Unexpected { , Expecting ( Fixed that below: function bb_url($str) { return preg_replace('#[URL=([^\']*)]([^\']*)[/URL]#', '<a href="\\1" target=_blank>\\2</a>', $str); } function bb_php($str) { $str = str_replace("]\n", "]", $str); $match = array('#\[php\](.*?)\[\/php\]#se'); $replace = array("'<div>'.highlight_string(stripslashes('$1'), true).'</div>'"); return preg_replace($match, $replace, $str); } function bb_img($str) { return preg_replace('#[IMG]([^\']*)[/IMG]#', '<img src="\\1" />', $str); } function bb_b($str) { return preg_replace('#[B]([^\']*)[/B]', '<strong>\\1</strong>', $str); } function bb_i($str) { return preg_replace('#[I]([^\']*)[/I]', '<em>\\1</em>', $str); } function bb_parse($str) { $str = bb_url($str); $str = bb_php($str); $str = bb_img($str); $str = bb_b($str); $str = bb_i($str); return $str } ---- Manual Page -- http://www.php.net/manual/en/function.highlight-string.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+56248 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56248&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56248&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56248&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56248&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56248&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56248&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+56248&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#94304) next »