<?php

$num = 44;

for($i=0; $i<20; $i++)
{
    $sum = 0;
    $number = (string)$num;
    for($c=0; $c < strlen($number);$c++)
    {
        $sum +=(int)$number[$c] * (int)$number[$c];
    }
    echo $sum . PHP_EOL;
    $num = $sum;
}