Hack: How to convert a keyset to a darray
Date: 2020-03-23 | darray | hack | hacklang | keyset |
DISCLOSURE: If you buy through affiliate links, I may earn a small commission. (disclosures)
problem
I've been using a lot more hacklang at work and have run across many usecases that don't have the greatest documentation. One such usecase is how to convert from a keyset to a darray. This is how I solved that.
solution
The darray actually has a pretty flexible constructor so you can create a darray from a keyset by simply passing the keyset into the darray.
For example:
$my_keyset = keyset['a', 'b'];
$my_darray = darray($my_keyset);
Want more like this?
The best way to support my work is to like / comment / share for the algorithm and subscribe for future updates.