If "some_func( &$var = NULL )" didn't work, then you're most likely using PHP 4. If that's the case then you could try passing an argument by reference in call(real/execution)-time, e.g:

  function some_func( $optional = NULL ) {
    ···
  }

  some_func();
  some_func(&$my_var);

Note: beware that the directive "allow_call_time_pass_reference"
      _must_ be On in your php.ini
      This functionality is deprecated, since PHP 5 does allow
      optional arguments-by-reference.

TomS wrote:
I would like to have an optional pass-by-reference. i.e. you can call the
function w/o the variable. Basically, like how you don't need to pass
$matches to the preg_match function. I've tried, function some_func(&$var =
null) and this doesn't work. func_get_args only gets copies, does anyone
have any other solutions?
--
Atentamente,
J. Rafael Salazar Magaña
Innox - Innovación Inteligente
Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE
http://www.innox.com.mx

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

Reply via email to