On Friday 03 January 2003 09:17 am, Shawn McKenzie wrote: > I have a script with some functions and within the script I want to read > the code from one of the functions into a string.
you'd probably have to fopen/fgets or file, and then parse for the function start and end and read the contents. i don't know of any functions in PHP that will let you do this automatically so you'll probably have to do this by hand. or pass it off to an external parsing program (written with whatever you prefer, flex and bison?) which returns the contents. sorry, i know that's not much help. but it looks like you'll have to do this the hard way. you don't have to do a full parse though if all you want is the text. you just need to identify function bodies, where the function body starts and ends, how to associate the function body with the function name, etc. you could probably do this even with just some basic text processing code instead of writing something using a lexer and parser. although the full lexer/parser path might be better (you can probably still avoid lexing or parsing most of the rest of the language). out of curiousity. what do you need this for? :) tiger -- Gerald Timothy Quimpo tiger*quimpo*org gquimpo*sni-inc.com tiger*sni*ph Public Key: "gpg --keyserver pgp.mit.edu --recv-keys 672F4C78" Veritas liberabit vos. Doveryai no proveryai. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php