Jump to content

functions within functions


Ninjakreborn

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.
Link to comment
https://forums.phpfreaks.com/topic/7962-functions-within-functions/
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]

Archived

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

×
×
  • Create New...

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.