<?
$a =10; $b = 20;
if( $a > $b) {
print" a is bigger than b";
}else if( $a == $b){
print"a is equal to b";
}else {
print "a is smaller than b";
}
?>
<hr>
<?
$i = 1;
while($i<=10){
print $i++;
}
?>
<hr>
<?
$i = 10;
do{
print $i;
$i--;
} while($i>0);
?>
<hr>
<?
for($i=1;$i<=10; $i++){
print $i;
}
for($i=1;;$i++){
if( $i > 10){
break;
}
print $i;
}
$i = 1;
for(;;){
if($i>10){
break;
}
print $i;
$i++;
}
?>
<hr>
<?
$arr=array("start","p1","p2","p3","stop","p5","p6");
$i=0;
while( $i < 10){
if($arr[$i] == "stop"){
break;
}
print "$arr[$i]   ";
$i++;
}
?>
<hr>
<?
print "안녕";
print("안녕");
echo "안녕";
echo ("안녕");
?>
<hr>
<?
$i = 2;
switch($i) {
case 0:
print "i equals 0";
break;
case 1:
print "i equals 1";
break;
case 2:
print "i equals 2";
break;
default:
print"i is not equal to 0, 1 or 2";
}
?>
<hr>
<?
function makecoffe( $type = "cappucino"){
echo "Making a cup of $type.<br>\n";
}
echo makecoffe();
echo makecoffe("esprecco");
?>