Write a Armstrong number or not program in php using while loop

Write a armstrong number or not program in php using while loop. This program is finding the number is Armstrong or not in PHP scripting. Program will check the number is armstrong number or not armstrong number in php

<?php 
$number=300;
$result=0;
$x=$number;
while($x!=0)
{
$bal=$x%10;
$result=$result+$bal*$bal*$bal;
$x=$x/10;
}
if($number==$result)
{
echo "it is an armstrong";
}
else
{
echo "it is not armstrong";
}
?>

Output:

it is not armstrong