NetCrack
Lieutenant
- Registriert
- Okt. 2001
- Beiträge
- 603
PHP:
<?php
error_reporting(E_ALL);
$a = 0;
$zahl = 2;
$test = array();
$prims = array("2", "3");
while ($zahl <= 50) {
while (count($prims) != $a) {
$temp = $zahl/$prims[$a];
$temp2 = number_format($temp, 0);
if ($temp != $temp2) {
$test[] = $temp;
}
$temp3 = count($prims);
$temp3--;
if (count($test) == $temp3) {
$prims[] = $zahl;
}
$a++;
}
$zahl++;
}
function read_array($array) {
$array_length = count($array);
$array_length--;
$a = 0;
$string = "";
while ($a <= $array_length) {
$string .= "$a.: <b>".$array[$a]."</b><br>";
$a++;
}
return($string);
}
echo "<br><br><br>Divsisoren:<br>";
echo read_array($test);
echo "<br><br><br>Prims:<br>";
echo read_array($prims);
?>
Warum gibt er bei count($test); 011 aus obwohl nur $test[0] belegt ist ?!?