Skip to main content

Name

hash_keys — return all the keys of a hash as a stringlist

Synopsis

hash_keys { hash }

Description

This function works on a hash created by hash_create and returns a stringlist containing all the keys of the hash. If the given hash is not empty, the elements in the returned stringlist are in random order. For an empty hash, the returned stringlist contains nothing.

$hash = hash_create;
hash_set $hash "mykey1" "myval1";
hash_set $hash "mykey2" "myval2";
hash_set $hash "mykey3" "myval3";
$keys = hash_keys $hash;
#keys is now a stringlist containing "mykey1", "mykey2" and "mykey3"

See Also

Was this page helpful?