getParametersEx again....

From: Date: Tue, 14 Sep 1999 12:58:47 +0000
Subject: getParametersEx again....
Groups: php.version4 
Request: Send a blank email to php-version4+get-4423@lists.php.net to get a copy of this message
just playing around.... PHP_FUNCTION(count) { pval **array; HashTable *target_hash; if (ARG_COUNT(ht) != 1 || getParametersEx(1, &array) == FAILURE) { WRONG_PARAM_COUNT; } target_hash = HASH_OF(*array); if (!target_hash) { if ((*array)->type == IS_STRING && (*array)->value.str.val==undefined_variable_string) { RETURN_LONG(0); } else { RETURN_LONG(1); } } RETURN_LONG(zend_hash_num_elements(target_hash)); } is this the "right" way of doing it? i believe that 'cause of the double refrencing in zvals (old mac-programmers would call it a "handle") this should work in all cases - and its faster than before. tc PS: this count implementation is always "fast" 'cause it *NEVER* copies the parameters (getParameters would copy!).

« previous php.version4 (#4423) next »