Home  >  Article  >  Backend Development  >  photoshop learning tutorial php learning process control implementation code

photoshop learning tutorial php learning process control implementation code

WBOY
WBOYOriginal
2016-07-29 08:45:28805browse

Copy the code The code is as follows:


/*
* Process control
*
* 1. Sequential structure
* 2. Branch structure--conditional structure--selection structure
* 1. Single-way branch
* //Condition bool, true or false, > < == !- & || !
* if (condition)
* Execute the following statement
* if (condition)
* {
* code Section;
* Code section;
* }
*
* 2. Two-way branch
* Use else clause
*
* if (condition)
* Execute a statement
* else
* Execute a statement
* if (condition ){
* One or more codes
* }else{
* One or more codes
* }
*
* 3. Multi-way branches
* You can use if else if and switch case
* //This is a A mutually exclusive relationship
* if(condition){
*
* }else if(condition){
* }else if(condition){
* }else{
* }
* 4. Nested branches
* if (){
* if(){
* }else{
* if(){}
* }
* }
* 3. Loop structure
*
*
*
*
*
* Summary:
* if To determine a range, use elseif
* If it is a single match, use switch case
*/
//Single-way execution
$a=10;
$b=5;
if($a > $b)
echo "$a is greater than $b";
//Dual-way execution
$a=10;
$b=20;
if($a>$b)
{
echo "$a is greater than $b";
}
else
{
echo "$a is less than $b
";
}
//Multiple execution
$hour=date("H");
if($hour > 6 && $hour < 9)
{
echo "good morning!":
}
else if($hour > 9 && $hour < 12)
{
echo "Good morning";
}
else if ($hour > 12 && $hour < 14)
{
echo "Good afternoon";
}
else if($hour > 14 && $hour < 17)
{
echo "Good afternoon";
}
else if($hour > 17 && $hour < 19)
{
echo "Good evening";
}
else if($hour > 19 && $hour <22)
{
echo "Evening" Good";
}
else
{
echo "Good night";
}
//Improve the code based on mutual exclusivity
$hour=date("H");
if($hour < 9)
{
echo "good morning!":
}
else if($hour < 12)
{
echo "Good morning";
}
else if($hour < 14)
{
echo case "Mon":
echo "Monday";
break;"Good afternoon";
}
else if($hour < 17)
{
echo "Good afternoon";
}
else if($hour > 19)
{
echo "Good evening";
}
else if($hour < 22)
{
echo "Good evening";
}
else
{
echo "Good evening";
}
//Judge the day of the week
$ week=date("D");//Get the day of the week
switch($week) //switch(variable) variables only use integers and strings
{
case "Mon":
echo "Monday";
break;
case "Tue"
echo "Tuesday";
break;
case "Wed":
echo "Wednesday";
break;
case "Thu":
echo "Thursday";
break;
case "Fri ":
echo "Friday";
break;
default:
echo "Weekend";
}
//Nested class
$sex=$_GET["sex"];
$age=$_GET["age" ];
if($sex=="nan")
{
if($age >= 60)
{
echo "This $sex has retired".($age-60)."years old";
}
else
{
echo "This man is still working, and".(60-$age)."retired only after 60 years";
}
}
else
{
if($age >= 66)
{
echo "This $sex has retired".($age-66)."years";
}
else
{
echo "This lady is still working, and".(66-$age)." Retired only when he was young";
}
}
?>

The above introduces the photoshop learning tutorial PHP learning process control implementation code, including the content of the photoshop learning tutorial. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn