PageRenderTime 34ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 0ms

/hphp/test/zend/good/ext/standard/tests/array/array_unique_basic.php

http://github.com/facebook/hiphop-php
PHP | 22 lines | 11 code | 4 blank | 7 comment | 0 complexity | 84e75066bf1cf800845047986109983a MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
  1. <?hh
  2. /* Prototype : array array_unique(array $input)
  3. * Description: Removes duplicate values from array
  4. * Source code: ext/standard/array.c
  5. */
  6. <<__EntryPoint>> function main(): void {
  7. echo "*** Testing array_unique() : basic functionality ***\n";
  8. // array with default keys
  9. $input = varray[1, 2, "1", '2'];
  10. var_dump( array_unique($input) );
  11. // associative array
  12. $input = darray["1" => "one", 1 => "one", 2 => "two", '2' => "two"];
  13. var_dump( array_unique($input) );
  14. // mixed array
  15. $input = darray["1" => "one", 0 => "two", 1 => "one", 2 => "two", 3 => "three"];
  16. var_dump( array_unique($input) );
  17. echo "Done";
  18. }