View Single Post
Old 06-25-2009, 10:35 PM   #8 (permalink)
Wildhoney
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,258
Thanks: 90
Wildhoney is on a distinguished road
Default

Yes. That's another way to do it, which is pretty much as below. Although I added them into a function for him.

php Code:
while (($iKey = array_search($szSearch, $aArray)) !== false)
{
    unset($aArray[$iKey]);
}

Then he also wanted to delete all the items whilst supplying many values, too. Which is just a loop inside a loop:

php Code:
foreach ($mSearch as $szSearch)
{
    while (($iKey = array_search($szSearch, $aArray)) !== false)
    {
        unset($aArray[$iKey]);
    }
}

Unless array_keys allows you to pass in an array, then you're also going to need a loop inside a loop.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote