Original
array | Removed | Added | New array |
---|
1. Adding two new elements to the middle |
---|
Array
(
[0] => Steinbeck
[1] => Kafka
[2] => Tolkien
)
| Array
(
)
| Array
(
[0] => Melville
[1] => Hardy
)
| Array
(
[0] => Steinbeck
[1] => Kafka
[2] => Melville
[3] => Hardy
[4] => Tolkien
)
|
2. Replacing two elements with a new
element |
---|
Array
(
[0] => Steinbeck
[1] => Kafka
[2] => Tolkien
)
| Array
(
[0] => Steinbeck
[1] => Kafka
)
| Array
(
[0] => Bronte
)
| Array
(
[0] => Bronte
[1] => Tolkien
)
|
3. Removing the last two elements |
---|
Array
(
[0] => Steinbeck
[1] => Kafka
[2] => Tolkien
)
| Array
(
[0] => Kafka
[1] => Tolkien
)
| Nothing | Array
(
[0] => Steinbeck
)
|
4. Inserting a string instead of an array |
---|
Array
(
[0] => Steinbeck
[1] => Kafka
[2] => Tolkien
)
| Array
(
)
| Orwell | Array
(
[0] => Steinbeck
[1] => Orwell
[2] => Kafka
[3] => Tolkien
)
|