[Php-tuxedo-development] Re: [PHP-DEV] Advice wanted on function arguments
Status: Pre-Alpha
Brought to you by:
cdog1977
From: Markus F. <mfi...@gu...> - 2002-01-05 20:41:41
|
On Sat, Jan 05, 2002 at 02:10:17PM -0600, Brian Foddy wrote : > 2. Overload the function arguments and check which type of arg is being > passed. Just accept a ZVAL and do your appropriate conversion later on. > > Questions... > 2. How difficult / successful is it to test the arg type for solution 2. It's a matter of switch(Z_TYPE_P(zval_container)) { case IS_STRING: // do appropriate conversion break; case IS_LONG: // everythings fine break; default: php_error(E_WARNING, "%s(): argument 1 must be integer or string", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } IMHO. Watch out, YMMV; HTH. -- Please always Cc to me when replying to me on the lists. |