데이터 베이스/웹 DB

웹 DB 실습 2

Gh1324 2019. 3. 13. 10:48
728x90

<?

$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] &nbsp ";

$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");


?>



728x90

'데이터 베이스 > 웹 DB' 카테고리의 다른 글

mysql 실습  (0) 2019.03.25
1부터 50까지 더하는 php 프로그램 작성하기  (0) 2019.03.20
웹 DB 실습 4  (0) 2019.03.20
웹 DB 실습 3  (0) 2019.03.18
웹 DB 실습 1  (0) 2019.03.13