Thanks! It worked On Mon, Jul 21, 2014 at 11:20 AM, Tjerk Meesters <tjerk.meest...@gmail.com> wrote: > > > > On Mon, Jul 21, 2014 at 11:12 AM, Aaron Lewis <the.warl0ck.1...@gmail.com> > wrote: >> >> Hi, >> >> I'm trying to iterate through a hash table, >> >> But the zend_hash_get_current_key() doesn't seem to move forward: >> I'm getting duplicate output at the 'fprintf' part. >> >> for(zend_hash_internal_pointer_reset_ex(ht, &pos); >> zend_hash_has_more_elements_ex(ht, &pos) == SUCCESS; >> zend_hash_move_forward_ex(ht, &pos)) >> { >> if (zend_hash_get_current_key (ht, &string_key, &num_key, 0) >> != HASH_KEY_IS_STRING) >> continue; >> >> fprintf (stderr, "string key: %s\n", string_key); >> } > > > The _ex() hash iteration functions allow for iterating a hash without > modifying its internal pointer, but zend_hash_get_current_key() uses only > the internal pointer. > > The function you need to use is: zend_hash_get_current_key_ex() and pass > &pos to it. > > >> >> >> Any ideas? >> >> >> -- >> Best Regards, >> Aaron Lewis - PGP: 0x13714D33 - http://pgp.mit.edu/ >> Finger Print: 9F67 391B B770 8FF6 99DC D92D 87F6 2602 1371 4D33 >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> > > > > -- > -- > Tjerk
-- Best Regards, Aaron Lewis - PGP: 0x13714D33 - http://pgp.mit.edu/ Finger Print: 9F67 391B B770 8FF6 99DC D92D 87F6 2602 1371 4D33 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php