Example of two PHP code writing methods. First, let's look at a simple example: Copy the code as follows :? Php $ a2; ($ a1 )? $ Test Enterprise: $ test region; # write echo $ test ;? First, let's look at a simple example:
The code is as follows:
$ A = 2;
($ A = 1 )? $ Test = "enterprise": $ test = "region"; # write method 1
Echo $ test;
?>
In the above example, first determine whether $ a is 1. if the string "enterprise" is saved to the $ test variable and then output, if the string "region" is not saved to the $ test variable and then output it;
The appeal example code is equivalent:
The code is as follows:
$ A = 2;
# Statement 2
$ Test = ($ a = 1 )? "Enterprise": "region ";
# Statement 3
If ($ a = 1 ){
$ Test = "enterprise ";
} Else {
$ Test = "region ";
}
Echo $ test;
?>
The pipeline code is as follows :? Php $ a = 2; ($ a = 1 )? $ Test = "enterprise": $ test = "region"; # write echo $ test ;? In the above example, first...