<?php
echo "Informe um natural: \n";
$numero = (int) trim(fgets(STDIN));
$divisor = $numero;
while($numero !== 1) {
    if ($divisor > 0) {
        $resto_divisao = $numero % $divisor;
        if($resto_divisao == 0) {
            echo $divisor. " é divisor de " . $numero . "\n";
            $divisor--;        
        } 
        if ($resto_divisao > 0) {
            $divisor--;
        }
    }
    else {
        break;
    }
}
?>

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: