Follow Star

1. Control Structures if

بناء الجملة .

if code .

1
2
if (Conditional) code;
if (Conditional){code};

1. if code .

1
2
3
4
5
6
7
<?php
$knows1 = 1;
$knows2 = 2;
if ($knows1 < $knows2)
echo "Hlloo Hier ist knows1";
// Outbut = Hlloo Hier ist knows1
?>

2. if code .

1
2
3
4
5
6
7
<?php
$knows1 = 2;
$knows2 = 2;
if ($knows1 < $knows2)
echo "Hlloo Hier ist knows1";
// Outbut = NULL
?>

3. if in HTML

1
2
3
4
<?php
if ($a == null): ?>
<p style="color:red;">I am red</p>
<?php endif; ?>

4. if code + html .

1
2
3
4
5
6
7
8
9
10
11
12
<!DOCTYPE html>
<html>
<body>
<?php
$a=6;
if ($a == 5): ?>
   <p style="color:red;">a == 5 </p>
  <?php else: ?>
<p style="color:blue;">leider $a !== 5</p>
<?php endif; ?>
</body>
</html>

5. if code .

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
$a = false;
$b = false;

if ( $a ) {
    $a = 'es ist true';
}elseif($b) {

echo $b = "es ist false";    

}else {
    echo $c = "es ist nicht false und true ";
}
echo $a;
?>

6. if code .

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
  $a="knows0";
  $b="knows0";

  if ($a<$b)
     {
    echo " es ist $a < $b ";
    }elseif ($a>$b) {

  echo  "es ist $a > $b";

  }else{

  echo "so get das";

  }              
?>
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