PHP conditional syntax: greater than

Posted December 27, 2003 by Quinn McHenry in PHP programming

To determine if a value is greater than another value, use:

if ($var > 0)
echo "var is positive and non-zero";

To determine if a value is greater than or equal to another value, use:

if ($var >= 0)
echo "var is positive";

 

About Quinn McHenry

Quinn was one of the original co-founders of Tech-Recipes. He is currently crafting iOS applications as a senior developer at Small Planet Digital in Brooklyn, New York.
View more articles by Quinn McHenry

The Conversation

Follow the reactions below and share your own thoughts.