Ninjakreborn Posted April 20, 2006 Share Posted April 20, 2006 How can I create a function within a function. For instanceI want to set my own user function, but I had a program within that, and I used like 6 preset functions, and wanted it all to run together when I call my user function, how do I do that, I searched around and found out about user functions, but not functions of functions or functions inside of user functions. Quote Link to comment https://forums.phpfreaks.com/topic/7962-functions-within-functions/ Share on other sites More sharing options...
ToonMariner Posted April 20, 2006 Share Posted April 20, 2006 do you mean creating a function on-the-fly???the only thing that would help is eval adn you create a string of teh whole function based on what ever info you feed that function. Quote Link to comment https://forums.phpfreaks.com/topic/7962-functions-within-functions/#findComment-29020 Share on other sites More sharing options...
Zane Posted April 20, 2006 Share Posted April 20, 2006 [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]do you mean creating a function on-the-fly???[/quote]I think he means that he wants to call functions from within a functionjust do it like you think you would[code]function Test() { return "function 1";}function Test2() { return "function 2";}function MainFunction() { $msg = Test(); $msg .= Test2(); return $msg;}echo Main();//returns function 1function2[/code] Quote Link to comment https://forums.phpfreaks.com/topic/7962-functions-within-functions/#findComment-29023 Share on other sites More sharing options...
Ninjakreborn Posted April 20, 2006 Author Share Posted April 20, 2006 now by looking at this I have something to "play with" and learn off of, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/7962-functions-within-functions/#findComment-29027 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.