Say I have a shape like this
$something = shape(
'some_key' => ...,
'another_key' => ...,
...
);
How can I iterate each field of the shape? I'm looking for something like this
foreach ($something as $key) {
...
}
Convert to a dict first with the built-in HH\Shapes::toDict then iterate:
foreach(HH\Shapes::toDict($something) as $k => $v) {
// ...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With