Community

PHP's Array_Filter Oddity

Published:

I was studying the array_filter in PHP and was enjoying coming up with a test that could help me learn better array_filter magic. For instance, to filter all words whose first letter is a vowel, I created this PHPUnit test: php public function testFilterVowelWords() { $vowel = function ($word) { $vowels = ["a", "e", "i", "o", "u"]; return in_array($word[0], $vowels);…

Read more...