This is my array. I want to push an element at index 3 and at the same time move the previous element to next. Please read first its not array_splice() work
array(6) {
[0]=>
string(1) "One_test"
[1]=>
string(1) "Two_test"
[2]=>
string(1) "Three_test"
[3]=>
string(1) "Four_test"
[4]=>
string(1) "Five_test"
[5]=>
string(1) "Six_test"
}
So my desired output is
array(6) {
[0]=>
string(1) "One_test"
[1]=>
string(1) "Two_test"
[2]=>
string(1) "Three_test"
[3]=>
string(1) "Six_test"
[4]=>
string(1) "Four_test"
[5]=>
string(1) "Five_test"
}
So notice I need replace 3rd indexed element with 5th indexed element and then move previously 3rd indexed element into next. Finally the pushed element (5th) to remove
Any Idea?
'a', 'b', 'c', 'd', 'e'and you wanna put in'x', and you get this:a b c x d eright?pop(). Lemme reopen. Sorry for that.