Follow Star

Control Structures Alternative

بناء الجملة .

1. Control Structures Alternative (if) .

1
(if): endif;

2. Control Structures Alternative (while) .

1
(while):  endwhile;

3. Control Structures Alternative (for) .

1
(for): endfor;

4. Control Structures Alternative (foreach) .

1
(foreach): endforeach;

5. Control Structures Alternative (switch) .

1
(switch): endswitch;

6. Control Structures Alternative .

1
2
3
4
5
6
7
8
9
10
11
12
<?php
<?php
$a = true;
$b = "1 + 6";
$c = "knows1";
if ($a === $b): ?>
<p> 1 </p>
<?php elseif($a): ?>
<p> 2 </p>
<?php else: ?>
<p> 3 </p>
<?php endif; ?>

7. Control Structures Alternative .

1
2
3
4
5
6
7
8
9
10
<?php
$knows1 = 2;
$knows2 = 2;
if ($knows1 >  $knows2): ?>
<h1> "Hlloo Hier ist knows1"</h1>
<?php elseif ($knows1 ): ?>
<h1> "knows1 ist = knows2 "</h1>
<?php else: ?>
  <h1> "x = knows1 , x = knows2"</h1>
<?php endif; ?>

8. Control Structures Alternative .

1
2
3
4
5
6
7
8
9
10
11
<?php
$knows1 = 100600;
$knows2 = 100601;
$knows3 = $knows1 + $knows2;?>
<?php if ($knows1 === $knows2):?>
<p> "$knows1 < $knows2"</p>
<?php elseif ($knows1 == $knows2):?>
<p> "xxxxxxxx"</p>
<?php else: ?>
<p> $knows3</p>
<<?php endif; ?>

9. Control Structures Alternative .

1
2
3
4
5
6
7
8
9
<?php
if ($a > null): ?>
<a href="https://fragen.knows1.com/php/php-Control-Structures-else/">else</a>

<?php elseif($a == null ): ?>
<a href="https://fragen.knows1.com/php/php-Control-Structures-else/">else</a>
<?php else: ?>
<a href="https://fragen.knows1.com/php/php-Control-Structures-else/">else</a>
<?php endif; ?>

10. Control Structures Alternative .

1
2
3
4
5
6
7
8
9
10
<?php
$a  = 2;
$b = 2;
 if ( $a == 1): ?>
<h1 style="background-color:#ff0000;">knows1</h1>
<?php elseif ($b < 1):?>
<h1 style="background-color:#0000ff;">knows1</h1>
<?php else:?>
<h1 style="background-color:#6a5acd;">knows1</h1>
<?php endif; ?>

11. Control Structures Alternative .

1
2
3
4
5
6
7
8
9
10
<?php
  $knows1="Hallo";
  $knows2="Hallo";
  if ($knows1<$knows2):?>
  <p> es ist $knows1 < $knows2   </p>
  <?php elseif ($knows1>$knows2):?>
  <p>"es ist $knows1 > $knows2"</p>
<?php else:?>
  <p>"so get elseif"</p>
<?php endif; ?>
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