[ create a new paste ] login | about

Link: http://codepad.org/cZImb4FI    [ raw code | output | fork ]

PHP, pasted on Jan 19:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php

$searchedForValue = 3;

$array1 = array(1,2,3,4,5,6);
$array2 = array(1,2,3,3,4,5);
$array3 = array(1,2,4,5,6);
$arr = array($array1,$array2 ,$array3);
function array_count_values_of($value, $array) {
    $counts = array_count_values($array);
    return $counts[$value];
}
foreach($arr as $ar){
if( array_count_values_of($searchedForValue,$ar)==1){echo "true";}else{echo "false";}
}

?>


Output:
1
truefalsefalse


Create a new paste based on this one


Comments: