Hi, i have this function that what should do is if the number you use ($nro), wich it will always be decimal, is greater than 9, it has to add all of its digits and then check if the result is greater than 9, and if it is do it again...and again, until necesary, and it should return, the number you entered, and all of its "reductions" with a / between
for example:
if $nro = 95 then it should be returned
95/14/5
but i always get 95/14/0
if you can help me i would be very gratefull...(i hope my enghlis is not too bad)
function ReducirNro($nro)
{
$Reduced = $nro;
if( $Reduced < 10 ) return "The number must be greater than 9";
$StrReduced = "$Reduced";
do
{
$Digits = strlen($Reduced);
$TempReduced = 0;
for( $i = 0; $i <= ($Digits-1); $i++)
$TempReduced += $Reduced{$i};
$Reduced = $TempReduced;
$StrReduced .= "/$Reduced";
}while($Reduced >= 10);
return $StrReduced;
}