Im new to PHP and I am trying to read user input in my code but im getting the error: Use of undefined constant STDIN - assumed 'STDIN'
<?php
echo "<h1>Armstrong number</h1>";
echo "Enter number: ";
fscanf(STDIN, "%d", $input); //Error Line
$n=$input;
$sum=0;
while($n != 0)
{
$rem = $n % 10;
$sum = $sum + $rem*$rem*$rem;
$n = $n / 10;
}
if ($input == $sum)
echo $input." entered is an armstrong no.";
else
echo $input." isnt an armstrong no.";
?>
``
Aucun commentaire:
Enregistrer un commentaire