Have some issue with returning a value in recursive function. But I can echo it. What could be wrong with this?
function calculate($i,$count=1)
{
$str_i = (string)$i;
$rslt = 1;
for ($k=0; $k<strlen($str_i); $k++) {
$rslt = $str_i[$k]*$rslt;
}
if ( strlen((string)$rslt) > 1 ) {
$this->calculate($rslt,++$count);
} elseif ( strlen((string)$rslt) == 1 ) {
return $count;
}
}