Create a method that takes an array of words (parameter) and counts the number of words that start with a specified character (parameter).?


Java Programming question.

1 Answer

  • 8 months ago

    function countWords($words, $char) { $c = 0; foreach($words as $word) { if(strpos(strtolower($word), strtolower($char)) === 0) { $c++; } } return $c; }

    • Commenter avatarLog in to reply to the answers
Still have questions? Get answers by asking now.