About create_function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
renaud
Forum Newbie
Posts: 1
Joined: Sat Aug 06, 2005 8:38 am

About create_function

Post by renaud »

As create_function create a function from a string, I'm looking to create a string from a function... well I need to analyse the content of a function before to execute it.
Thank you in advance
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

If you used create_function, then you must have the string. Since you don't have the string, you didn't use create function. That means you want to move a global function to a string. But you need to analyse the content of the function before executing it. Global functions don't need to be analyzed.

Contradiction!

Please explain your problem more clearly. Where are these functions coming from? And why do you need to analyze them?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

if you are using php5, you can use the ReflectionFunction class to find out information about a function, although not the internals of the function, however it can tell you what line the function starts and stops at and what file it's defined in..
Post Reply