...

View Full Version : Deleting array index, how?



kaisellgren
11-10-2006, 07:35 PM
Hi,

I have an array:

$sentences = array("1","2","3","4");

How can I delete an index or indexes? I don't want to leave empty stringed array indexes...

Thank you!

mlseim
11-10-2006, 08:19 PM
This:

// Now delete every item, but leave the array itself intact:
foreach ($sentences as $i => $value) {
unset($sentences[$i]);
}

Comes from this site:
http://us2.php.net/types.array



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum