Pyramid program in PHP

$max = 5; //any numeric value to be assigned here
for($i=1;$i<=$max;$i++)
{      
    inter($i,$max);
}
for($i=$max-1;$i>=1;$i--)
{      
  inter($i,$max);    
}

function sp($j,$max)
{
   for($i=$j;$i<$max;$i++)
   {
     echo '&nbsp;&nbsp;&nbsp;';
   }
}
function inter($i,$max)
{
    $j=1;
    sp($i,$max);
    while ($j<=$i)
    {      
        echo '&nbsp;'.$j;      
        
        if($j==$i)
        {  
            $m = $j-1;
            while ($m>=1)
            {
                echo '&nbsp;'.$m;  
                $m--;
            }
        }
        $j++;
    }
    echo '<br/>';
}

Comments