Skip to content

Instantly share code, notes, and snippets.

@Znarkus
Created March 9, 2012 12:18
Show Gist options
  • Save Znarkus/2006296 to your computer and use it in GitHub Desktop.
Save Znarkus/2006296 to your computer and use it in GitHub Desktop.
<?php
$nummer=$_POST['nummer'];
// hämtar inmatat värde från första sidan
$under50 = array();
$over50 = array();
if (is_numeric($nummer))
{
for($x=1 ; $x <=$nummer; $x++)
{
$rand = rand(0, 100);
echo ' ' . $rand . '<br/>';
if ($rand < 50) {
$under50[] = $rand;
} else {
$over50[] = $rand;
}
}
} else {
echo "Skärp dig, skriv ett numeriskt värde mellan 1-100.";
}
echo '<br/>&lt; 50<br/>';
foreach ($under50 as $v) {
echo "{$v}<br/>";
}
echo '<br/>&gt;= 50<br/>';
foreach ($over50 as $v) {
echo "{$v}<br/>";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment