Search for content in functions with regex

Posted by Marlun on Stack Overflow See other posts from Stack Overflow or by Marlun
Published on 2010-02-26T19:01:49Z Indexed on 2010/04/04 2:03 UTC
Read the original article Hit count: 293

Filed under:
|

Hello,

How would I with regular expression search for functions which contains the use of a global variable without running "global $var" first?

The files looks like this:

class TestClass
{
    function correctFunc()
    {
        global $var;
        $name = $var->name;
    }

    function invalidFuncIWantToFind()
    {
        $age = $var->user->age;
    }
}

I want to find the function names of all the invalidFuncIWantToFind. At work this would have really speeded up our work but I didn't get how to do it.

© Stack Overflow or respective owner

Related posts about regex

Related posts about recursion