Condtional Operator

3 posts Page 1 of 1
Contributors
User avatar
Rookie
Top Poster
Top Poster
Posts: 85
Joined: Thu May 19, 2011 10:28 am

Condtional Operator
Rookie
Hi i'll be giving you some example of conditional expression that can guide you
Code: Select all
<?php
$number = 1111;
($number <1) ? $Result = 
"The $number variable contains a negative value. " : $Result ="The $number variable contains a positive value.";echo "<p>", $Result, "</p><br/>"?>
just change the expression($Result)

hope this will help you clapper;
User avatar
Kelly
Linux Users
Linux Users
Posts: 11
Joined: Sun Nov 20, 2011 5:49 am

Re: Condtional Operator
Kelly
This is also known as the Ternary Operator.
User avatar
Rookie
Top Poster
Top Poster
Posts: 85
Joined: Thu May 19, 2011 10:28 am

Re: Condtional Operator
Rookie
oh really ?
thanks. i learned that from my professor
3 posts Page 1 of 1
Return to “Help & Support”