I got an array that consists of elements that are arrays also. Now I
wish I could add an element to the middle of it. Let mi give you an
example:
array (
- array(1,15,appl e),
- array(2,28,bana na),
- array(3,41,oran ge)
}
I would like to add, let's say, carrot on 2nd position:
array (
- array(1,15,appl e),
- array(2,57,carr ot),
- array(3,28,bana na),
- array(4,41,oran ge)
}
Sorry for that kind of presentation, but it's clear i think.
Array_splice() does not work (or maybe i use it in a wrong way? - it
splits an adding element for, in that case, 3 elements). Array_push()
adds only to the end of an array. can samobody tell me how to add and
element to the middle of an associative array?
I hope you can understand what i've written here :)
Thanx,
maciej
wish I could add an element to the middle of it. Let mi give you an
example:
array (
- array(1,15,appl e),
- array(2,28,bana na),
- array(3,41,oran ge)
}
I would like to add, let's say, carrot on 2nd position:
array (
- array(1,15,appl e),
- array(2,57,carr ot),
- array(3,28,bana na),
- array(4,41,oran ge)
}
Sorry for that kind of presentation, but it's clear i think.
Array_splice() does not work (or maybe i use it in a wrong way? - it
splits an adding element for, in that case, 3 elements). Array_push()
adds only to the end of an array. can samobody tell me how to add and
element to the middle of an associative array?
I hope you can understand what i've written here :)
Thanx,
maciej
Comment