PageRenderTime 115ms CodeModel.GetById 32ms RepoModel.GetById 1ms app.codeStats 0ms

/4.0/Testing/Tests/Arrays/array_unique.php

#
PHP | 21 lines | 14 code | 4 blank | 3 comment | 0 complexity | c8d1a26e8316854076199a4eba333a9b MD5 | raw file
Possible License(s): CPL-1.0, GPL-2.0, CC-BY-SA-3.0, MPL-2.0-no-copyleft-exception, Apache-2.0
  1. [expect php]
  2. [file]
  3. <?
  4. function test(&$a)
  5. {
  6. $arr = array( 4,3,4,3,2,1,2,1,4,3,2,1 );
  7. $arr[] = &$a;
  8. $arr[] = $a;
  9. var_dump($arr);
  10. // check whether values are preserved in the same order
  11. // without duplicities
  12. // preserving the first unique entry
  13. var_dump(array_unique($arr));
  14. }
  15. $x = 5;
  16. test($x);
  17. ?>