Forum Moderators: coopster

Message Too Old, No Replies

Unset function?

How do you unset a function like you would a variable?

         

benj0323

6:24 pm on Jul 26, 2005 (gmt 0)

10+ Year Member



I was wondering how I would go about accomplishing this:

function some_func() {
print 'hey';
}

unset(some_func());

Is this possible, or is there a more professional way to unset a function instead of doing:

function some_func() {
}

Thanks for your help.

jatar_k

6:25 pm on Jul 26, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I don't understand why you would need or want to do this.

want to hit us up with the logic you are trying to acheive and I am sure there is an alternative.

benj0323

12:18 am on Jul 27, 2005 (gmt 0)

10+ Year Member



It's actually pretty complicated.

I'd be here all day explaining why I need to do this. For now I'm just doing:

function func_name() {}

It works but Id rather unset it.

jatar_k

1:51 am on Jul 27, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



there is no unset for functions

unset() destroys the specified variables.

unsetting a function isn't really something that should be necessary, that's why I was asking. Please don't take offence but I think your logic went awry somewhere if this is required.

Though if it is that complicated then I am sure you have evaluated all of your options, sometimes things just need to be how they need to be and concessions are made.

benj0323

2:26 am on Jul 27, 2005 (gmt 0)

10+ Year Member



Well basically I'm using the smarty template engine and integrating it in with my software. I dont want to go into smarty and edit the code so I can easily update smarty in the future. Smarty provides a function called smarty_function_popup. It provides tooltips that I use in my software. In their user account they can turn this off, so basically I need to unset the function so that in the smarty templates this function doesnt work.

Unsetting the function is much better logic vs. putting if statements around each time I use the popup function.

jatar_k

3:42 am on Jul 27, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



it's a hack ;)

but you are right, I think the way you are doing it is the best way.