Jump to content

dynamic function calls!


Recommended Posts

I need a hand in implementing dynamic function calls.

I would like to keep an array of strings, that map to function names like...

global $myarray[3]

$myarray[0] = "function1"

$myarray[1] = "function2"

$myarray[2] = "function3"

this is for an irc bot, where i would have a help command return this array of available commands. then when you send a command, have it call that function.

so when someone in irc says.. function1

it would iterate throguh the available strings in this array, realize that function1 exists and attempt to invoke a function called...function1.

so basically, given a string that represents the name of a function, how can i invoke that function?

I also need to have the ability to check if the function exists, is a try catch that best way to accomplish that?

Link to comment
Share on other sites

lol that is an awesome error message.. even when you don't WANT to see one... lol

Sets @error to 0xDEAD and @extended to 0xBEEF if the function does not exist or invalid number of parameters.

0xBEEF... WTF hahahaha SWEET i never noticed that before

and

I wouldn't call staying up at 2 am when you should be sleeping free time.

wow man.... all i have to say...

Edited by CodyBarrett
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...