remove values from an array php

Posted by LiveEn on Stack Overflow See other posts from Stack Overflow or by LiveEn
Published on 2010-03-09T08:35:07Z Indexed on 2010/03/09 8:51 UTC
Read the original article Hit count: 279

Filed under:
|

I have a array of links and i have another array which contains certain values i would like to filter in the list eg:

http://www.liquidshredder.co.uk/shop%3Fkw%3Dsurfboards%26fl%3D330343%26ci%3D3889610385%26network%3Ds
http://www.bournemouth-surfing.co.uk/index.php%3FcPath%3D32
http://www.stcstores.co.uk/wetsuit-range-sizing--pricing-info-1-w.asp
http://www.kingofwatersports.com/wetsuit-sale-c227.html
http://www.uk.best-price.com/search/landing/query/bodyboards/s/google/altk/Surf%2Band/koid/1944273223/
http://www.surfinghardware.co.uk/Results.cfm%3Fcategory%3D20%26kw%3Dbodyboards%26fl%3D11407%26ci%3D3326979552%26network%3Ds
http://www.teste.co.uk/adtrack/baod.html
http://www.teste.co.uk/bodyboards/
www.sandskater.co.uk/
www.sandskater.co.uk/bodyboards/+Bodyboards&sa=X&ei=GwSWS-KaGM24rAeF-vCKDA&ved=0CBMQHzAKOAo
http://www.extremesportstrader.co.uk/buy/water/bodyboarding/
www.extremesportstrader.co.uk/buy/water/bodyboarding/+Bodyboards&sa=X&ei=GwSWS-KaGM24rAeF-vCKDA&ved=0CBYQHzALOAo
www.circle-one.co.uk/+Bodyboards&sa=X&ei=GwSWS-KaGM24rAeF-vCKDA&ved=0CBkQHzAMOAo
http://www.teste.co.uk/bodyboards/p1
http://www.teste.co.uk/bodyboards/p2
http://www.amazon.co.uk/s/%3Fie%3DUTF8%26keywords%3Dbodyboards%26tag%3Dgooghydr-21%26index%3Daps%26hvadid%3D4764625891%26ref%3Dpd_sl_2lyzsfw1ar_e
http://www.teste.co.uk/bodyboards/p3
www.extremesportstrader.co.uk/buy/water/

and i would like to remove all the instances of "http://www.teste.co.uk"?

i tried the below code but it doesn't work :(

$remove=array("teste.co.uk","127.0.0.1","localhost","wikipedia.org","gmail.com","answers.yahoo.com");

foreach ($list[0] as $key=>$clean)
{
    if (in_array($clean,$remove)) 
    {               
        unset($list[0][$key]);
    }

    echo $clean;
    echo '<br>';   
}

© Stack Overflow or respective owner

Related posts about php

Related posts about array