diff options
author | Colin O'Dell <colinodell@gmail.com> | 2019-10-21 17:22:04 -0400 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-10-23 11:22:12 +0200 |
commit | e7335eb420e40d2226fbf1c2b573875323667560 (patch) | |
tree | 20a1c59dbb337e8f255ce3a5eeaa69529b4771b3 /ext/standard/tests | |
parent | 80103bdb78544495d6a34cbd75fac25492832a95 (diff) | |
download | php-git-e7335eb420e40d2226fbf1c2b573875323667560.tar.gz |
Allow array_splice() length to be null
Diffstat (limited to 'ext/standard/tests')
-rw-r--r-- | ext/standard/tests/array/array_splice_basic.phpt | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/ext/standard/tests/array/array_splice_basic.phpt b/ext/standard/tests/array/array_splice_basic.phpt index 9a96ccb362..cf6fcd1db2 100644 --- a/ext/standard/tests/array/array_splice_basic.phpt +++ b/ext/standard/tests/array/array_splice_basic.phpt @@ -14,6 +14,12 @@ var_dump (array_splice($input, 2)); var_dump ($input); // $input is now array("red", "green") +echo "test truncation with null length \n"; +$input = array("red", "green", "blue", "yellow"); +var_dump (array_splice($input, 2, null)); +var_dump ($input); +// $input is now array("red", "green") + echo "test removing entries from the middle \n"; $input = array("red", "green", "blue", "yellow"); var_dump (array_splice($input, 1, -1)); @@ -56,6 +62,19 @@ array(2) { [1]=> string(5) "green" } +test truncation with null length +array(2) { + [0]=> + string(4) "blue" + [1]=> + string(6) "yellow" +} +array(2) { + [0]=> + string(3) "red" + [1]=> + string(5) "green" +} test removing entries from the middle array(2) { [0]=> |