note 129189 added to control-structures.for
| From: | rivetmibrum at main dot php dot net | Date: | Mon, 22 Jan 2024 18:13:32 +0000 |
| Subject: | note 129189 added to control-structures.for | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221143@lists.php.net to get a copy of this message | ||
<html>
<body>
<?php
// Store the first 10 even numbers in an array
$evenNumbers = [];
$counter = 0;
for ($i = 2; $counter < 10; $i += 2) {
$evenNumbers[] = $i;
$counter++;
}
// Print the even numbers on the screen
foreach ($evenNumbers as $number) {
echo $number . "<br>";
}
?>
</body>
</html>
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.157.134 (proxied: 5.224.210.226)
----
Manual Page -- https://php.net/manual/en/control-structures.for.php
Edit -- https://main.php.net/note/edit/129189
Del: integrated -- https://main.php.net/note/delete/129189/integrated
Del: useless -- https://main.php.net/note/delete/129189/useless
Del: bad code -- https://main.php.net/note/delete/129189/bad+code
Del: spam -- https://main.php.net/note/delete/129189/spam
Del: non-english -- https://main.php.net/note/delete/129189/non-english
Del: in docs -- https://main.php.net/note/delete/129189/in+docs
Del: other reasons-- https://main.php.net/note/delete/129189
Reject -- https://main.php.net/note/reject/129189
Search -- https://main.php.net/manage/user-notes.php