Community

Php's Array_filter Oddity

Published: July 08, 2015

I was studying the arrayfilter in PHP and was enjoying coming up with a test that could help me learn better arrayfilter 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 inarray($word[0], $vowels);…

Read more...