isDefine - isset & empty function


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



Copy this code and paste it in your HTML
  1. function isDefine($str) {
  2. if(is_array($str)){
  3. foreach($str as $key => $value) {
  4. if(isset($str[$key]) and !empty($str[$key])) {
  5. $res[] = true;
  6. } else {
  7. $res[] = false;
  8. }
  9. if(array_search(false, $res) === true) {
  10. return false;
  11. }
  12. }
  13. } else {
  14. if(isset($str) and !empty($str)) {
  15. return true;
  16. }
  17. }
  18. return false;
  19. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.