Hello! I'm writting my own extension and I have a list of values which
must be indexed by a keyword, so when the user wants to retrieve one of them
by giving me the keyword I can quickly return him/her the associated value.
    I implemented a couple of functions which operate two arrays of char *
(char *keywords[] and char *values[]),. so that the functions dinamically
add or remove strings from this arrays, so everytime the user asks for a
value (giving its key), I must traverse the keywords array, find the index
of that key, and look in the values array for the value of the index found.
    Quite primitive, but it works. :-)

    However, I've seen that the Zend API has it's own hash api, and I wonder
if I could use its functions to achieve the intended behaviour in a more
professional way.
    So, I've though that I can create a zval of type array, and use
zend_hash_update() to associatively add elements to this array, so that -as
long as I don't include this zval in the PHP symbol table- those values will
be mine and only mine (not accessible from the PHP script).

    So... do you think I will notice any significant speed improvement by
using the zend hash api over my poor-man style coded functions?
    Do you think it's the way to go?

    Thank you very much in advance,

    Oriol Magrané




-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to