分支 2018-11-23 11:43

分支:

<?php
header('Content-type:text/html;charset=utf-8');

$number=3;

if ($number>5) {
	echo 'if';
}else{
	echo 'else';
}


switch:

<?php
header('Content-type:text/html;charset=utf-8');

$number=8;

switch ($number){
	case 1:
		echo 'a';
		break;

	case 2:
		echo 'b';
		break;

	case 3:
		echo 'c';
		break;
	
	default:
		echo 'z';
		break;
}