The following program is an example using the structure of the special condition? in PHP. The structure of these condition can be applied for checking simple condition, such as IF ELSE.
<? php
$ year = date ("Y");
$ leap = ($ year% 4 == 0)? "leap": "NOT a leap";
echo "Year $ year </ b> $ leap";
?>
$ year = date ("Y");
$ leap = ($ year% 4 == 0)? "leap": "NOT a leap";
echo "Year $ year </ b> $ leap";
?>
Program Explanation:
In the above program, the function date () with parameter "Y" (2nd row) will produce 4-digit years now. On the 3rd line will be checked whether the contents of the variable $ year if dimodulus by 4 will yield the value 0. If TRUE then $ leap will contain the "leap" and if FALSE $ leap will contain the "NON-leap"
In the above program, the function date () with parameter "Y" (2nd row) will produce 4-digit years now. On the 3rd line will be checked whether the contents of the variable $ year if dimodulus by 4 will yield the value 0. If TRUE then $ leap will contain the "leap" and if FALSE $ leap will contain the "NON-leap"
0 comments on Structure Of The Special Conditions? In PHP :
Post a Comment and Don't Spam!
Dont Spam please