seventheyejosh Posted September 14, 2009 Share Posted September 14, 2009 Is it possible to create a function in a function? like: class test{ function a(){ function b(){ echo "yo"; } } } then do $test=new test(); test::a::b(); I don't believe this will work. But is there any way to? Quote Link to comment https://forums.phpfreaks.com/topic/174207-solved-function-in-function/ Share on other sites More sharing options...
Zane Posted September 14, 2009 Share Posted September 14, 2009 no... what are you trying to do Quote Link to comment https://forums.phpfreaks.com/topic/174207-solved-function-in-function/#findComment-918344 Share on other sites More sharing options...
Daniel0 Posted September 14, 2009 Share Posted September 14, 2009 You can return an anonymous function using create_function() or using the new support for closures in PHP 5.3. Quote Link to comment https://forums.phpfreaks.com/topic/174207-solved-function-in-function/#findComment-918389 Share on other sites More sharing options...
xangelo Posted November 12, 2009 Share Posted November 12, 2009 It looks like you're talking about chaining. Placing a function within another function (which is already in a class) would do nothing except organize how you would call your code. Quote Link to comment https://forums.phpfreaks.com/topic/174207-solved-function-in-function/#findComment-956367 Share on other sites More sharing options...
seventheyejosh Posted November 13, 2009 Author Share Posted November 13, 2009 This probably should have been marked solved some time ago. My bad. Quote Link to comment https://forums.phpfreaks.com/topic/174207-solved-function-in-function/#findComment-956555 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.