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.
$foo = array('one'); $foofoo = array('onekey' => 'onevalue');
配列にキーが 1 つしか含まれていないかどうかを確認するにはどうすればよいですか?
count()配列に含まれる要素の数がわかります
count()
if (count($foo) === 1) { echo 'This array contains one value'; }