array_splice_variation4.phpt 923 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. --TEST--
  2. Test array_splice() function : usage variations - non array replacement values
  3. --FILE--
  4. <?php
  5. /*
  6. * proto array array_splice(array input, int offset [, int length [, array replacement]])
  7. * Function is implemented in ext/standard/array.c
  8. */
  9. function test_splice ($replacement)
  10. {
  11. $input_array=array(0,1);
  12. var_dump (array_splice ($input_array,2,0,$replacement));
  13. var_dump ($input_array);
  14. }
  15. test_splice (2);
  16. test_splice (2.1);
  17. test_splice (true);
  18. //file type resource
  19. $file_handle = fopen(__FILE__, "r");
  20. test_splice ($file_handle);
  21. echo "Done\n";
  22. ?>
  23. --EXPECTF--
  24. array(0) {
  25. }
  26. array(3) {
  27. [0]=>
  28. int(0)
  29. [1]=>
  30. int(1)
  31. [2]=>
  32. int(2)
  33. }
  34. array(0) {
  35. }
  36. array(3) {
  37. [0]=>
  38. int(0)
  39. [1]=>
  40. int(1)
  41. [2]=>
  42. float(2.1)
  43. }
  44. array(0) {
  45. }
  46. array(3) {
  47. [0]=>
  48. int(0)
  49. [1]=>
  50. int(1)
  51. [2]=>
  52. bool(true)
  53. }
  54. array(0) {
  55. }
  56. array(3) {
  57. [0]=>
  58. int(0)
  59. [1]=>
  60. int(1)
  61. [2]=>
  62. resource(%d) of type (stream)
  63. }
  64. Done