login  Naam:   Wachtwoord: 
Registreer je!
 Scripts:

Scripts > PHP > Handige scripts > Array_empty

Array_empty

Auteur: nick5556 - 16 april 2010 - 12:33 - Gekeurd door: Ibrahim - Hits: 3085 - Aantal punten: (0 stemmen)



Dit script controleerd of een van de sleutels in de array leeg is.

Special thanks to: Ibrahim.

Code:
  1. /*
  2.   * @version: 1.0
  3.   * @author: Nick Smit <nick.smit@quicknet.nl>
  4.   * @thanks: Ibrahim Abdullah
  5.   * @param: array $array The array to check
  6.   * @param: boolean $useKey[optional] false for only value array, true for key-value array, default value is false
  7.   * @return: true if no empty values found, false if empty falue is found
  8. */
  9.  
  10. function empty_array($array, $useKey = false) {
  11. if(is_array($array)) {
  12.  
  13. foreach($array as $key => $value) {
  14. $val = ($useKey ? $key : $value);
  15. if(empty($val)) {
  16. return true;
  17. }
  18. }
  19.  
  20. } else {
  21.  
  22. return true;
  23. }
  24.  
  25. return false;
  26. }

Download code! Download code (.txt)

 Stemmen
Niet ingelogd.

 Reacties
Post een reactie
Geen reacties (0)
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.018s