Essay record
Hack: How to convert a keyset to a vec
- Record
- Essay / / 1 min read / 68 words
On this page2 sections / +
DISCLOSURE: Some links may be affiliate links. Details
problem
I've been using a lot more Hack / hacklang at work and have run into several cases where there's not great documentation. One of those cases is when trying to convert a keyset to a vec.
solution
To convert a keyset to a vec you can use the Vec\keys function from the standard library.
An example:
$my_keyset = keyset['a', 'b'];
$my_vec = Vec\keys($my_keyset);