Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Loop test</title>
- </head>
- <body>
- Set the p GET variable for setting total loops<br/>
- For example, run:<br/>
- <code><?php
- $n = rand(5 ,100);
- echo( '<a href="'.$_SERVER['PHP_SELF'] . "?p=$n".'">' . $_SERVER['PHP_SELF'] . "?p=$n" . '</a>' ); ?></code> to get <?php echo $n; ?> iterations.<br/>
- Default is 10.
- <hr/>
- <?php
- // get the user GET value
- $p = (int) @$_GET['p'];
- // is p is not set then loop 10 times
- if ($p == '') { $p=10; }
- for ($i=1; $i <= $p; $i++) {
- echo "Hello $i<br/>";
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement