$sayi = 120; for($i = 2;$i<=$sayi;$i++){ if($sayi%$i == 0){ $bolenler[] = $i; } } echo max($bolenler);