Hi.
I've got this simple function:
<?php
$poolsresult = array('x','1','2','1','x');
$userforecast = array('x','1','1','x','1');
function getScore($answersGame,$answersUser)
{
$score = 0;
foreach($answersGame as $key => $value)
{
if($value==$answersUser[$key])
{
$score++;
}
}
return $score;
}
//It works
echo getScore($poolsresult,$userforecast);
echo "<br>";
//I tried with array_intersect but
//It doesn't work
$count = array_intersect($poolsresult,$userforecast);
echo count($count);
?>
Now I'm wondering is there a better way
to work out the score ?
Thanks in advance ;)
Take care.