eval() or call_user_func() ???

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Anyone know of the pros and cons of these two?

I am writing a simplified 'clone' of crontab, to help me run scheduled  
tasks - the tasks (scipts) vbeing stored in a database table - I'm not  
sure which of these to use, any ideas ? Is one better than the other ?

Re: eval() or call_user_func() ???

call_user_func only works if you have the function declared in the
script (not a string). eval is really your only option
Bit Byte wrote:
Quoted text here. Click to load it

Re: eval() or call_user_func() ???

Benjamin wrote:

Quoted text here. Click to load it

Thanks Ben, do you know if eval can be 'disabled' by a PHP setting (i.e.  
in the PHP config file) by a hosting provider (maybe to prevent people  
from dynamically running scripts) ?

I wnat to make sure that if I go to the trouble of writng this, it will  
work (i.e. not be "snuffed out") by an over zealous ys admin at my  
hosting provider.

Re: eval() or call_user_func() ???

Bit Byte wrote:
Quoted text here. Click to load it

Any function *can* be disabled.  Some are disabled for good reason (i.e.  
security).  But if your host has disabled eval() and won't enable it,  
get another host.  There are too many around to worry about one.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Site Timeline