is_empty() : safely test for an empty string (or mixed variable)


/ Published in: PHP
Save to your folder(s)

a function to safely test for an empty string (or mixed variable) in cases when "0" is not intended to be empty


Copy this code and paste it in your HTML
  1. function _empty($string){
  2. $string = trim($string);
  3. if(!is_numeric($string)) return empty($string);
  4. return FALSE;
  5. }

Report this snippet


Comments


You need to login to view comments.