Re: stripping enclosed text from PHP code
| From: | Robin Vickery | Date: | Mon, 10 Apr 2006 10:04:28 +0000 |
| Subject: | Re: stripping enclosed text from PHP code | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-233661@lists.php.net to get a copy of this message | ||
On 09/04/06, Winfried Meining <wim@csb.ki.se> wrote:
>
> Hi,
>
> I am writing on a script that parses a PHP script and finds all function calls
> to check, if these functions exist. To do this, I needed a function that would
> strip out all text, which is enclosed in apostrophes or quotation marks. This
> is somewhat tricky, as the script needs to be aware of what really is an
> enclosed text and what is PHP code.
So use the built in tokenizer functions which know exactly what's
enclosed text and what is php code. Much quicker and more reliable
than trying to do the same job with regular expressions.
http://se.php.net/tokenizer
-robin