The function below is trying to find whole numbers. But somehow I'm not doing this right as it shows every number to be whole (no digits after .)
$max_value % 1
should only return true is there is no rest value??
Can anyone help me, now every check gives 0 as result.
Hope I explain well what I mean
solution(30);
function solution($a){
$sides_short = array();
$sides_long = array();
$max_number = $a/2;
$total = $a;
for($i=1;$i<=$max_number;$i++){
$min_value = $i;
$max_value = $a / $min_value;
echo "loop values: ".$min_value." x ".$max_value."<br>";
if($max_value % 1 == 0) {
echo ($max_value % 1) ."<br>";
echo "Aproved: (".$min_value." x ".$max_value.") $max_value % 1 = ".($max_value % 1)."<br><br>";
$sides_short[] = $min_value;
$sides_long[] = $max_value;
}
}
}