PageRenderTime 82ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/2.0/Tests/Arrays/array_slice.php

#
PHP | 37 lines | 36 code | 1 blank | 0 comment | 0 complexity | 73043f8478108990b2a9062bff52f51b 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 exact]
  2. array
  3. (
  4. [0] => c
  5. [Y] => d
  6. [1] => e
  7. )
  8. array
  9. (
  10. [Y] => d
  11. )
  12. array
  13. (
  14. [0] => a
  15. [X] => b
  16. [1] => c
  17. )
  18. array
  19. (
  20. [0] => c
  21. [Y] => d
  22. )
  23. array
  24. (
  25. [2] => c
  26. [Y] => d
  27. )
  28. [file]
  29. <?
  30. $input = array(1 => "a", "X" => "b", 2 => "c", "Y" => "d", 3 => "e");
  31. print_r(array_slice($input, 2));
  32. print_r(array_slice($input, -2, 1));
  33. print_r(array_slice($input, 0, 3));
  34. print_r(array_slice($input, 2, -1));
  35. print_r(array_slice($input, 2, -1, true));
  36. ?>