<?php
function sumArr($arr) {
$num = array_sum($arr);
if($num > 9) {
return str_split($num);
}
return $num;
}
$n = (str_replace('.', '', $argv[1]));
do{
$a = sumArr(str_split($n));
if(is_array($a)){
$n = implode('', $a);
}
}
while(is_array($a));
echo $a;
?>