Skip to main content
added commenting to the code originally provided.
Source Link
chris
  • 37k
  • 54
  • 149
  • 256
$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.

$var = 'abcdef'; if (strlen($var)<0); { } else { } 

This is a simple example. Hope it helps.

$var = 'abcdef'; if(isset($var)) { if (strlen($var) > 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.

Post Undeleted by Akos
Post Deleted by Akos
Source Link
Akos
  • 2k
  • 6
  • 28
  • 42

$var = 'abcdef'; if (strlen($var)<0); { } else { } 

This is a simple example. Hope it helps.