* Thus wrote Tom Rogers ([EMAIL PROTECTED]):
> Hi,
> 
> Friday, April 30, 2004, 3:51:19 AM, you wrote:
> 
> 
> JB> I know I'm probably paranoid, but eval() always bugs me.  I think for
> JB> what you want to do you can use call_user_func_array()
> 
> JB> $args = func_get_args();
> JB> call_user_func_array('function_to_call', $args);
> 
> JB> http://www.php.net/manual/en/function.call-user-func-array.php
> 
> The only time eval can be a problem is if you use it on client
> supplied data otherwise it is no worse than any other function.

It is *very* expensive to use eval, expecially when this has been
said:

  If eval() is the answer, you're almost certainly asking the
  wrong question. -- Rasmus Lerdorf, BDFL of PHP


Here are a couple alternatives:

function argbyref(&$args) {
    $args['arg'] = 'changed';
}
$args['arg'] = 'not changed';
argbyref($args);


function argwitharray($args) {
    $args['arg'] = 'changed';
}
$arg = 'not changed';
argwitharray(array('arg' => &$arg));


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to