I notice that none of your variables use the PHP convention of $ preceding
the variable name, I also do not see you defining a value for DEFAULT_VALUE,
which by the upper case convention seems to be referring to a global
constant.  Is it not true (no pun intended) that if a variable (or constant)
has not been defined, that assigning the contents of that variable (or value
of the constant) will return a false (i.e. a 1)?

Not sure I remember it all correctly but it seems to ring an ancient bell
for me.

HTH,

Warren Vail

-----Original Message-----
From: Quanah Gibson-Mount [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 27, 2004 4:35 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Default value if parameter is not passed in


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

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

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

Reply via email to