Follow Star

Control Structures => for


1
2
for (value1; condition; value2)
    statement

1. for

1
2
3
4
5
6
<?php

for ($a = 10; $a !== 0; $a--) {
    echo "$a.<br>";
}
 ?>

2. for


1
2
3
4
5
6
7
<?php

 ##  for ($; ; value2 ) {if() {} }

for ($a = 10; ; $a--)
{if($a < 0){break;}echo $a;}
?>

3. for


1
2
3
4
5
6
7
8
9
10
11
 ##  for (; ; ) {() {} }

$i = 0;
for (; ; ) {
    if ($i >= 10) {
        break;
    }
    echo "$i<br>";
    $i++;
}
?>

4. for


1
2
3
4
5
6
7
8
9
10
 <?php
 ##  for (a b c d f g h j ; condition; statement Operators; );
for ($a = 0,
     $b = 10,
     $c = 10;
     $a <= 20;
     $b -= $c,
     print "$a<br>",
     $a++);
?>

5. for


1
2
3
4
5
6
<?php
for ($a = 1; $a <= 10 ; $a++): ?>

  <h1> ich bin N : <?php echo $a ?> <h1>

<?php endfor; ?>

6. for


1
2
3
4
5
<?php
for($a = 'a',  $b = 1; $a != 'z',  $b <= 24; $a++. $b++ ) {
    echo "$a   und du ! <br> $b ich bin :";
}
?>
Control Structures      
if      
else      
elseif/else if      
Alternative syntax for control structures      
while      
do-while      
for      
foreach      
break      
continue      
switch      
declare      
return      
require      
include      
require_once      
include_once      
goto      

Tags:

Categories:

Updated:

Comments