Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ユーザーが単語を入力するときに、100単語のリストに対してチェックする必要があるという特定の入力があります。これらの単語を最も簡単にループするにはどうすればよいでしょうか? 大規模な配列を使用する必要がありますか?
大文字と小文字の区別やタイプミスを気にしない場合は、これが最も簡単な方法です。
$word = 'foo'; $wordList = array('foo', 'bar', 'baz', ...); $wordIsInWordList = in_array($word, $wordList);