Generally we will write like this:
Copy code The code is as follows:
if($_GET['time']==null)
{
$time = time();
}
else
{
$time = $_GET['time'];
}
echo $time;
//If GET has the value of time, bring in the variable time, if not, bring the current time() time
?>
Copy the code The code is as follows:
< ;?
$time = ($_GET['time']==null) ? (time()) : ($_GET['time']);
echo $time;
?>
Copy code The code is as follows:
$a = 5; //Define variable a=5
$b = 3; //Define variable b=5
$c = ($ a==$b) ? ("yes") : ("no");
//If a=b, c=yes; a is not equal to b, c=no
?>
Copy code The code is as follows:
$bool = true;
if($bool)
{
setValueFun();
}
Copy code The code is as follows:
$bool && setValueFun();
The above introduces what else means. PHP IF ELSE simplifies/the use of ternary one-time formula, including what else means. I hope it will be helpful to friends who are interested in PHP tutorials.