Default value if parameter is not passed in
| From: | Quanah Gibson-Mount | Date: | Wed, 27 Oct 2004 23:34:36 +0000 |
| Subject: | Default value if parameter is not passed in | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-200496@lists.php.net to get a copy of this message | ||
Right now, I'm tweaking a function that has a bunch of optional parameters. I would like to be able to set a default value for the very last one if it is not passed in. This essentially looks like:
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ssl", &link, &arg1, &arg1_len, &arg2, &arg2_len, &long, &long_len) == FAILURE { RETURN_FALSE; }
if (!long || long==NULL) {
long=DEFAULT_VALUE;} However, what I found when printing out the value of "long" is that it has been set to 1?! I imagine this was by the zend_parse_parameters function. Is there a way to disable it from setting values to optional parameters? --Quanah -- Quanah Gibson-Mount Principal Software Developer ITSS/Shared Services Stanford University GnuPG Public Key: http://www.stanford.edu/~quanah/pgp.html