Fonksiyon değil + elle yazdım biraz (

) + "tam" sayıyı bulamıyorum ama genellikle (2-3 sayı hariç) istediğim rakamı veriyor:
<?php
for ($n = 1; $n <= 100; $n++)
{
$x0 = (strlen($n)) * 10 * 10;
$x1 = 0.5 * ($x0 + ($n / $x0));
$x2 = 0.5 * ($x1 + ($n / $x1));
$x3 = 0.5 * ($x2 + ($n / $x2));
$x4 = 0.5 * ($x3 + ($n / $x3));
$x5 = 0.5 * ($x4 + ($n / $x4));
$x6 = 0.5 * ($x5 + ($n / $x5));
$x7 = 0.5 * ($x6 + ($n / $x6));
$x8 = 0.5 * ($x7 + ($n / $x7));
$x9 = 0.5 * ($x8 + ($n / $x8));
echo '<table>';
echo '<tr><td>'; echo 'Number: '; echo '</td><td>'; echo $n; echo '</td></tr>';
echo '<tr><td>'; echo 'My sqrt: '; echo '</td><td>'; echo round($x9, 5); echo '</td></tr>';
echo '<tr><td>'; echo 'sqrt(): '; echo '</td><td>'; echo round(sqrt($n), 5); echo '</td></tr>';
echo '<tr><td>----</td></tr>';
echo '</table>';
}
?>
ha şu yabanci sitedeki şu functionu isteyen senmiydin
<?php
function mysqrt($xxx,$top,$round)
{
$content='';
for ($n = 1; $n <= $xxx; $n++)
{
$x0 = (strlen($n)) * 10 * 10;
for($i=0;$i<=$top;$i++)
{
if($i=='0')
{
$x1x[$i] = 0.5 * ($x0 + ($n / $x0));
}
else
{
$x1x[$i] = 0.5 * ($x1x[$i-1] + ($n / $x1x[$i-1]));
}
}
$topitop=$x1x[$top];
$content.= "<table>\n";
$content.= "<tr><td> Number: </td><td>" . $n . "</td></tr>\n";
$content.= "<tr><td>My sqrt: </td><td>" . round($topitop, $round) . "</td></tr>\n";
$content.= "<tr><td> sqrt(): "."</td><td>" . round(sqrt($n), $round) . "</td></tr>\n";
$content.= "<tr><td>----</td></tr>\n";
$content.= "</table>\n\n";
}
return $content;
}
echo mysqrt(100,10,5);
?>