PageRenderTime 43ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/hphp/test/slow/ext_array/array_multisort.php

http://github.com/facebook/hiphop-php
PHP | 43 lines | 37 code | 6 blank | 0 comment | 0 complexity | 148bd9d66a7b82871d446d9a3aa8ad07 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. function a() {
  3. $ar1 = varray[10, 100, 100, 0];
  4. $ar2 = varray[1, 3, 2, 4];
  5. array_multisort2(inout $ar1, inout $ar2);
  6. var_dump($ar1);
  7. var_dump($ar2);
  8. }
  9. function b() {
  10. $ar0 = varray["10", 11, 100, 100, "a"];
  11. $ar1 = varray[1, 2, "2", 3, 1];
  12. $asc = SORT_ASC;
  13. $string = SORT_STRING;
  14. $numeric = SORT_NUMERIC;
  15. $desc = SORT_DESC;
  16. array_multisort6(inout $ar0, inout $asc, inout $string, inout $ar1, inout $numeric, inout $desc);
  17. $ar = varray[
  18. $ar0,
  19. $ar1,
  20. ];
  21. var_dump($ar);
  22. }
  23. function c() {
  24. $array = varray["Alpha", "atomic", "Beta", "bank"];
  25. $array_lowercase = array_map(fun("strtolower"), $array);
  26. $asc = SORT_ASC;
  27. $string = SORT_STRING;
  28. array_multisort4(inout $array_lowercase,
  29. inout $asc, inout $string, inout $array);
  30. var_dump($array);
  31. }
  32. <<__EntryPoint>>
  33. function main_array_multisort() {
  34. a();
  35. b();
  36. c();
  37. }