$a=Array(1,1,0,1,0) ;
$b=Array(0,0,0,1,0) ;
$a=Array(1,1,0,1,0);
$b=Array(0,0,0,1,0);
function getSimilarity($a1, $a2) {
$c1 = count($a1);
$same = 0;
for($i = 0; $i < $c1; $i++) {
if($a1[$i] == $a2[$i]) {
$same++;
}
}
return 100 * $same / $с1;
}
print_r( getSimilarity($a, $b) . '%' );