How to get the Entire Function from a file

Posted by SoLoGHoST on Stack Overflow See other posts from Stack Overflow or by SoLoGHoST
Published on 2010-05-01T18:13:43Z Indexed on 2010/05/01 18:17 UTC
Read the original article Hit count: 229

Filed under:
|
|

Ok, I'm reading through a file now, line by line. I know each functions name in the file, since it is defined elsewhere in an XML document. That is what should be this:

function function_name

Where function_name is the name of the function.

I get all of the function definitions from an XML document that I already have put into an array of function names, and I need to grab just those functions from the php file. And rebuild that php file so that it only has those functions in it. That is to say, if a php file has more functions than what is defined in the XML tag, than I need to strip out those functions, and rewrite the .php file with only the functions that the user specified in the XML file.

So, the dilemma I face is how to determine the END of a function reading line by line, and I'm aware that functions can have function within them. So I don't want to remove the functions within them. Just functions that are standalone and aren't defined within the accompanying XML file. Any ideas on how to do this??

Thanks :)

© Stack Overflow or respective owner

Related posts about php

Related posts about functions