Project

General

Profile

« Previous | Next » 

Revision 93dfa097

Added by Andreas Kohlbecker about 3 years ago

method to check variables for isset & not empty - improved

View differences:

modules/cdm_dataportal/includes/common.inc
921 921
 * @return bool
922 922
 *  True if the variable is set and is not NULL an is not empty.
923 923
 */
924
function isset_not_empty($var){
925
  return isset($var) & $var;
924
function isset_not_empty(&$var){
925
  if (!isset($var)){
926
    return false;
927
  }
928
  if(is_numeric($var)) {
929
    return true;
930
  } else if(is_array($var)){
931
    return count($var) > 0;
932
  } else {
933
    return !!$var;
934
  }
935

  
926 936
}

Also available in: Unified diff