while ($getal <= 80){ $getal = rand (1, 100); $getallen[] = $getal; } return $getallen;*/ $getallen = array(); for ($i = 1; $i <= 50; $i += 2) { $getallen[] = $i; } for ($i = 2; $i <= 50; $i += 2) { $getallen[] = $i; } return $getallen; } } ?> <!DOCTYPE HTML> <html> <head> <meta charset=utf-8> <title>Ingredienten</title> </head> <body> <pre> <?php $array = new arrayGenerator(); print_r($array->getArray()); ?> </pre> </body> </html>
$getal = rand(1, 40); $getallen[$getal]++; } return $getallen; } } ?> <!DOCTYPE HTML> <html> <head> <meta charset=utf-8> <title>Ingredienten</title> </head> <body> <ul> <?php $array = new arrayGenerator(); $tabel = $array->getArray(); foreach ($tabel as $sleutel => $waarde) { print "<li>"; print "Getal "; print $sleutel; print " werd "; print $waarde; print " keer gegenereerd."; print "</li>"; } ?> </ul> </body> </html>