removing an array elements...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
matthiasone
Forum Contributor
Posts: 117
Joined: Mon Jul 22, 2002 12:14 pm
Location: Texas, USA
Contact:

removing an array elements...

Post by matthiasone »

is there an easy way to removing an array element from an 3-demisional array?
I have an array:

Code: Select all

$currentї'group']ї1]ї'item1']
$currentї'group']ї1]ї'item2']
$currentї'group']ї1]ї'item3']
$currentї'group']ї2]ї'item1']
$currentї'group']ї2]ї'item2']
$currentї'group']ї2]ї'item3']
$currentї'group']ї3]ї'item1']
$currentї'group']ї3]ї'item2']
$currentї'group']ї3]ї'item3']
Now I want to remove

Code: Select all

$currentїgroup']ї2]
What is the easiest way?

Matt 8O
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

Code: Select all

unset($currentїgroup']ї2]);
matthiasone
Forum Contributor
Posts: 117
Joined: Mon Jul 22, 2002 12:14 pm
Location: Texas, USA
Contact:

Post by matthiasone »

does that apply to $_Session?
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Yes you can do

Code: Select all

unset($_SESSIONї'var'])
to unset a session variable. If you want to get rid of a session altogether though you need to use session_destroy().

Mac
Post Reply