Inserting element into array
Posted: Sat Mar 18, 2006 8:27 pm
I have an array:
I want to insert a new element into the above, but want control over which index my new element will reside in.
I have tried:
But this overwrites the existing element and I need to just insert not overwrite...I should hilite emphasis on insert so just adding a new element to the array is not the only thing required, but insertion at a particular index.
Anyone know of an array function or technique I can use to accomplish whats desired???
Thanks
Code: Select all
$arr = array('html',
array('head',
array('title', null),
array('style', null),
array('script', null)
)
);I have tried:
Code: Select all
$arr[1][1] = array('style2', null);Anyone know of an array function or technique I can use to accomplish whats desired???
Thanks