Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete from middle of array how?

Status
Not open for further replies.

gokeeffe

Programmer
Jan 11, 2005
170
0
0
IE
How do I do the following

I have a mutidimensional array, for example it might contain
6 different pieces of information

$_SESSION['grind_array'][] = array( 'Interest' => $_SESSION['Interest'],
'Subject' => $_SESSION['Subject'],
'Level' => $_SESSION['Level']
);

1
interest:computers
subject: php
level: higher
2
interest:computers
subject: C++
level: higher
3
interest:computers
subject: VB
level: higher
4
interest:computers
subject: Java
level: higher
5
interest:computers
subject: Pascal
level: higher
6
interest:computers
subject: Dreamweaver
level: higher




Now for example if I want to delete the 4th array element

interest:computers
subject: Java
level: higher

how do you do this, i know push() and shift() functions delete elements from the begining
and end of the array but how to I delete from the center.

I will have a checkbox beside each array element, if you tick the checkbox and press remove
then the array associated with the checkbox will be removed.

I hope this makes sense as I have exhasuted every angle I have tried

Regards
 
use the array_splice() method...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top