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. 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. 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] 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. Link to comment https://forums.phpfreaks.com/topic/7962-functions-within-functions/#findComment-29027 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.