Preferably I'd like a solution which allows me to parse PHP from PHP, but any solution is welcome. (As an example of what I'm looking for, Ruby has the - amongst others - ruby_parser
gem.)
Edit:
I am looking to generate abstract syntax trees of some kind, from PHP code. (And unless I am mistaken, I am fully aware of the existence and behaviour of the eval
function.)
What are the options (if any) for parsing PHP code to some sort of abstract syntax tree? And what are the options for turning these syntax trees back into (readable) PHP code?