同じ値を持つ2つの配列を比較したり、配列に値が存在するかどうかを確認したりすることについて多くの質問がありますが、この質問はどこにも見つかりません:
特定の変数/値が1つの配列に2回以上存在するかどうかを確認するにはどうすればよいですか?
例えば:
$array_to_check = array( "this", "this" , "yes" , "no" , "maybe" , "yes" , "yes" );
$this_value = "this";
// how to check if $this_value or 'this' value exist more than twice in $array_to_check array:
// if it exist more than twice, echo yes it exist more than once!!
チェックする変数とチェックする配列をパラメーターとして挿入し、変数値が配列内に2回以上存在する場合にtrueを返すことができる関数があるかどうかを確認することもできます。
例えば:
$function check_if_more_than_two($the_variable_to_check, $array_to_check)
どうもありがとうございます。どんな助けでも大歓迎です:)