PHP conditional syntax: greater than

Contributor Icon Contributed by qmchenry Date Icon December 27, 2003  
Tag Icon Tagged: 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";

Previous recipe | Next recipe |
 
blog comments powered by Disqus