Code Archive/php

Step3. 조건문

쌍큐 2017. 3. 3. 18:38

<?php

$a=10;

$b=20;

print $a==$b;

print $a>=$b;

print $a<=$b;

print $a<$b;

print $a>$b;

print $a<>$b;

print “<br>”;

if ($a==$b) {

print “a와 b는 같다”;

}elseif($a<$b){

print “a는 b보다 작다”;

}else{

print “모든 조건이 만족하지 않음”;

}

print “<br>”;

switch ($a) {

case 10:

print “값이 10”;

break;

case 20:

print “값이 20”;

break;


default:

print “default area”;

break;

}

?>


비교 연산자


<  >  <=  >=  ==  <>

'Code Archive > php' 카테고리의 다른 글

Step5. 날짜 표시 함수  (0) 2017.03.03
Step4. 반복문  (0) 2017.03.03
STEP2. 변수 선언하기  (0) 2017.03.03
php 기본 문법  (0) 2015.06.11
php 설치 및 셋팅  (0) 2015.06.11