please help problem in checkdominance

The sum result should checked all the column, but the result from the my script only check the first column for return the sum instead of check all the 3column, sorry if anyone i can’t find out anything wrong with the script below…thanks

$ds = array(
array(10,2,2),
array(50,10,5),
array(30,9,4),
);

function finddom($ds,$i){
$sum=0;
for ($j=0; $j<3; $j++){
if ($j!=$i){
for ($k=0; ($k<3)&$ds[$i][$k]>$ds[$j][$k]; $k++){
if($k=3){
$sum=$sum+1;
}
}
}
}
return $sum;
}

for($i=0; $i<3; $i++){
$dom;
$dom[$i]=finddom($ds, $i);
}

echo “

”;
print_r($dom);
Sponsor our Newsletter | Privacy Policy | Terms of Service