| zurück | PHP - Ablaufsteuerung  | |||||
Allgemeines  | 
Zur Ablaufsteuerung sind folgende Elemente erfügbar:
  | 
|||||
if  | 
f (Bedingung) eine Anweisung; | if (Bedingung) {Aktion: mehrere Anweisungen}; | if ($a > $b) echo „$a ist größer als $B“; | if ($_POST["klin"] == "*")  { if ($schema == "b") { $datact = "rch-dummy.php"; $sch = "Rektum - Ca postoperativ"; } }  | 
||
else  | 
 
if  ($a  >  $b)  { echo  "a  ist  größer  als  b";} else {echo "a ist NICHT größer als b";}  | 
elseif  | 
 
if ($a > $b) {echo "a ist größer als b";}  elseif ($a == $b) {echo "a ist gleich b";} else {echo "a ist kleiner als b";}  | 
|||
while  | 
Doppelpunkt - Syntax | while (Abbruchbedingung): Anweisung; Anweisung; ... endwhile;  | 
Abbruchkriterium wird am Anfang geprüft. | $i  =  1; while ($i <= 10): echo $i; $i++; endwhile;  | do while | do  {Anweisung; Anweisung ... ;} while (Bedingung);  | 
Abbruchkriterium wird erst am Ende geprüft. | 
$i = 0; do { echo $i; } while ($i>0);  | 
do {Anweisung; Anweisung ... ;}  while (Bedingung)
Impressum .....................................................................................Zuletzt geändert am 03.01.2014 23:25