array_unique_variation8.phpt 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. --TEST--
  2. Test array_unique() function : usage variations - two dimensional arrays
  3. --FILE--
  4. <?php
  5. /* Prototype : array array_unique(array $input)
  6. * Description: Removes duplicate values from array
  7. * Source code: ext/standard/array.c
  8. */
  9. /*
  10. * Testing the functionality of array_unique() by passing
  11. * two dimensional arrays for $input argument.
  12. */
  13. echo "*** Testing array_unique() : two dimensional array for \$input argument ***\n";
  14. // initialize the 2-d array
  15. $input = array(
  16. array(1, 2, 3, 1),
  17. array("hello", "world", "str1" => "hello", "str2" => 'world'),
  18. array(1 => "one", 2 => "two", "one", 'two'),
  19. array(1, 2, 3, 1)
  20. );
  21. var_dump( array_unique($input, SORT_STRING) );
  22. echo "Done";
  23. ?>
  24. --EXPECTF--
  25. *** Testing array_unique() : two dimensional array for $input argument ***
  26. Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
  27. Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
  28. Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
  29. Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
  30. Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
  31. Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
  32. Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
  33. Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
  34. Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
  35. Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
  36. Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
  37. Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
  38. Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
  39. Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
  40. array(1) {
  41. [0]=>
  42. array(4) {
  43. [0]=>
  44. int(1)
  45. [1]=>
  46. int(2)
  47. [2]=>
  48. int(3)
  49. [3]=>
  50. int(1)
  51. }
  52. }
  53. Done