note 29844 deleted from function.preg-replace-callback by sniper
| From: | sniper@php.net | Date: | Tue, 30 Sep 2003 12:26:12 +0000 |
| Subject: | note 29844 deleted from function.preg-replace-callback by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57453@lists.php.net to get a copy of this message | ||
Note Submitter: chris@mad-teaparty.com
----
preg_replace_callback is the best solution to parse HTML-tags, as you can use the same invoked
function for different numbers of attributes, e.g. if you want to cache them in an array in order to
restructure the document or the tags later. The code gets clearer and you don't need to define
several replacements for it. It also seems to accept all kinds of characters in the subpatterns.
(quoted delimiters like "\{" or "\(" are treated as characters and not as
delimiters when they are passed to the callback-function)