Jump to content


Photo

functions within functions


  • Please log in to reply
3 replies to this topic

#1 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 20 April 2006 - 03:47 PM

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.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#2 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 20 April 2006 - 04:00 PM

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.
follow me on twitter @PHPsycho

#3 Zane

Zane
  • Administrators
  • Advanced Member
  • 4,134 posts

Posted 20 April 2006 - 04:07 PM

[!--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
function Test() {
 return "function 1";
}
function Test2() {
 return "function 2";
}

function MainFunction() {
  $msg = Test();
  $msg .= Test2();
  return $msg;
}

echo Main();
//returns function 1function2

btn_donate_SM.gif Want to thank me? Contribute to my PayPal piggy-bank
 

172938.png

#4 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 20 April 2006 - 04:13 PM

now by looking at this I have something to "play with" and learn off of, thanks.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users