note 77255 added to function.preg-replace
| From: | rob at ubrio dot us | Date: | Tue, 21 Aug 2007 20:48:37 +0000 |
| Subject: | note 77255 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-129679@lists.php.net to get a copy of this message | ||
Also worth noting is that you can use array_keys()/array_values() with preg_replace like:
$subs = array(
'/\[b\](.+)\[\/b\]/Ui' => '<strong>$1</strong>',
'/_(.+)_/Ui' => '<em>$1</em>'
...
...
);
$raw_text = '[b]this is bold[/b] and this is _italic!_';
$bb_text = preg_replace(array_keys($subs), array_values($subs), $raw_text);
----
Server IP: 208.69.120.35
Probable Submitter: 198.185.18.207
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- https://master.php.net/note/edit/77255
Del: integrated -- https://master.php.net/note/delete/77255/integrated
Del: useless -- https://master.php.net/note/delete/77255/useless
Del: bad code -- https://master.php.net/note/delete/77255/bad+code
Del: spam -- https://master.php.net/note/delete/77255/spam
Del: non-english -- https://master.php.net/note/delete/77255/non-english
Del: in docs -- https://master.php.net/note/delete/77255/in+docs
Del: other reasons-- https://master.php.net/note/delete/77255
Reject -- https://master.php.net/note/reject/77255
Search -- https://master.php.net/manage/user-notes.php