Jump to content

Archived

This topic is now archived and is closed to further replies.

Ninjakreborn

functions within functions

Recommended Posts

How can I create a function within a function. For instance
I 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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
[!--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 function

just 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]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.