array_unique_variation7.phpt 768 B

123456789101112131415161718192021222324252627282930313233
  1. --TEST--
  2. Test array_unique() function : usage variations - binary safe checking
  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 an array having binary values.
  11. */
  12. echo "*** Testing array_unique() : array with binary data for \$input argument ***\n";
  13. // array with binary values
  14. $input = array( b"1", b"hello", "world", "str1" => "hello", "str2" => "world");
  15. var_dump( array_unique($input) );
  16. echo "Done";
  17. ?>
  18. --EXPECTF--
  19. *** Testing array_unique() : array with binary data for $input argument ***
  20. array(3) {
  21. [0]=>
  22. string(1) "1"
  23. [1]=>
  24. string(5) "hello"
  25. [2]=>
  26. string(5) "world"
  27. }
  28. Done