$var = 'abcdef'; if(isset($var)) { if (strlen($var)<0 > 0); { //do something, string length greater than zero } else { //do something else, string length 0 or less } } This is a simple example. Hope it helps.
edit: added isset in the event a variable isn't defined like above, it would cause an error, checking to see if its first set at the least will help remove some headache down the road.