array.lib.php 980 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /* For licensing terms, see /dokeos_license.txt */
  3. /**
  4. ==============================================================================
  5. * This is the array library for Dokeos.
  6. * Include/require it in your code to use its functionality.
  7. *
  8. * @package dokeos.library
  9. ==============================================================================
  10. */
  11. /*
  12. ==============================================================================
  13. FUNCTIONS
  14. ==============================================================================
  15. */
  16. /**
  17. * Removes duplicate values from a dimensional array
  18. *
  19. * @param array a dimensional array
  20. * @return array an array with unique values
  21. */
  22. function array_unique_dimensional($array)
  23. {
  24. if(!is_array($array))
  25. return $array;
  26. foreach ($array as &$myvalue){
  27. $myvalue=serialize($myvalue);
  28. }
  29. $array=array_unique($array);
  30. foreach ($array as &$myvalue){
  31. $myvalue=unserialize($myvalue);
  32. }
  33. return $array;
  34. }
  35. ?>