Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

So simple yet it does not work...

Status
Not open for further replies.

jbezzina

MIS
May 4, 2004
46
0
0
MT
Why am I getting that $num is greater than seven when it's clear that this its not.

<?PHP

$num = 7;
echo ($num==7) ? "num is seven" : ($num>7) ? "num is greater than seven" : "num is an unknown";

?>
 
You've got a problem with where you've placed the braces there I think.

Try this:

Code:
<?PHP

$num = 7;
echo $num==7 ? "num is seven" : ($num>7 ? "num is greater than seven" : "num is an unknown");

?>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top