Re: Orphan functions?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I gotcha now. I misspoke about writing a tokenizer function, I understood that it would be a script.

That's for the suggestion. Though, I was hoping to avoid reinventing something that already exists.

Robert Cummings wrote:
On Fri, 2007-06-01 at 14:40 -0400, Al wrote:
I appreciate the response and looked at the tokenizer doc; but, I'm missing your point. Are you implying I should write a Tokenizer Function to do the job?

Nope, tokenizer function already exists. I'm suggesting it wouldn't be
too hard to write a script that traverses your source tree, parses the
scripts using PHP's tokenizer functions, traverses the tokens and tells
you exactly what you want to know :)

Just a matter of:

    1. Recording declared functions/methods.
    2. Tracking a counter for when the function is used.
    3. After all is done, displaying functions/methods with 0 counter.

This won't catch eval'd uses of functions, or other dynamic calling of
functions. But it will probably give you a good idea where to look,
possibly using grep. Dynamically called functions are non-deterministic
and so the only way to catch their usage is via a profiler, and then
again, it'll only get counted if it actually gets used during run-time.

Cheers,
Rob.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux