i wrote this one to get over the problem i found in getting strings intersected instead of arrays as there is no function in php.
<?php
function matched_main_numbers($string, $string2)
{
$string = "04 16 17 20 29";
$arr1 = explode(" ", $string);
$string2 = "45 34 04 29 16";
$arr2 = explode(" ", $string2);
$array = array_intersect($arr1, $arr2);
$comma_separated = implode($array);
$str = $comma_separated;
$balls = "$comma_separated";
$matched_balls = chunk_split($balls,2," ");
$matched_balls =" $matched_balls";
$number_of_matched_main_balls = strlen($str);
$number_of_matched_main_balls = ($number_of_matched_main_balls/2);
$numbers = "You matched $number_of_matched_main_balls main balls";
return $numbers;
}
?>