Simple array question

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
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Simple array question

Post by pickle »

Hi all,

I was wondering if there's an easy way to empty an array. I've got an array already full of values, and I want to remove all index/value associations so the array becomes empty. Due to the type flexibility in PHP, I've managed to do a workaround by just setting the array to = ''. I know it's extremely ugly, but that's why I'm posing the question here. Thanks in advance for any help/suggestions.
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

unset($array);
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Yep, that did it. Thanks.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply