Skip to content

Instantly share code, notes, and snippets.

@samikeijonen
Created November 9, 2012 09:18
Show Gist options
  • Save samikeijonen/4044704 to your computer and use it in GitHub Desktop.
Save samikeijonen/4044704 to your computer and use it in GitHub Desktop.
Sami keijonen: Tehtävä 1
<!DOCTYPE html>
<html>
<head>
<title>Silmukat</title>
</head>
<body>
<h1>Silmukkarakenteet</h1>
<?php
/* While-silmukka. */
$k = 1;
while( $k < 101 ) {
echo "Luku on " . $k . "<br />\n";
$k++; // Sama asia kuin $k = $k + 1 eli lisätään luku 1
}
/* Sama asia for-silmukka. */
for( $s=1; $s < 101; $s++ ) {
echo "Luku on " . $s . "<br />\n";
}
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment