note 105057 added to control-structures.continue
| From: | Anonymous at osu1 dot php dot net | Date: | Mon, 25 Jul 2011 16:22:50 +0000 |
| Subject: | note 105057 added to control-structures.continue | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-181857@lists.php.net to get a copy of this message | ||
function print_primes_between($x,$y)
{
for($i=$x;$i<=$y;$i++)
{
for($j= 2; $j < $i; $j++) if($i%$j==0) continue 2;
echo $i.",";
}
}
This function, using continue syntax, is to print prime numbers between given numbers, x and y.
For example, print_primes_between(10,20) will output:
11,13,17,19,23,29,
----
Server IP: 69.147.83.197
Probable Submitter: 220.255.2.141 (proxied: 119.74.229.127)
----
Manual Page -- http://www.php.net/manual/en/control-structures.continue.php
Edit -- https://master.php.net/note/edit/105057
Del: integrated -- https://master.php.net/note/delete/105057/integrated
Del: useless -- https://master.php.net/note/delete/105057/useless
Del: bad code -- https://master.php.net/note/delete/105057/bad+code
Del: spam -- https://master.php.net/note/delete/105057/spam
Del: non-english -- https://master.php.net/note/delete/105057/non-english
Del: in docs -- https://master.php.net/note/delete/105057/in+docs
Del: other reasons-- https://master.php.net/note/delete/105057
Reject -- https://master.php.net/note/reject/105057
Search -- https://master.php.net/manage/user-notes.php