3 ms·
maybe off-topic, but I think the Swift version looks nice: words.filter { WORDS.contains($0) }.forEach { w in ... }
by nielsbot 4y ago
maybe off-topic, but I think the Swift version looks nice:
words.filter { WORDS.contains($0) }.forEach { w in
...
}
- withinboredom 4y agoAnd then php: array_map(fn($match) => print($match), array_filter($words, fn($_) => in_array($_, WORDS))); or less verbosely: array_map(fn($match) => print($match), array_intersect($words, WORDS));