Question: This is the code I have written so far:

```
foreach ($link_body as $key => $unfinished_link)
{   
    #further Remove non ad links
    if (stristr($unfinished_link, "inactive" OR "nofollow") === TRUE)
    {   
        unset($link_body[$key]);
    }   

    echo "<font color='#FFFFFF' size='16'>$unfinished_link</font><br>";
}

```

I'm not getting any error messages but I keep getting results that look like this:

```
/cars/" />
/cars/">
/cars/" class="inactive">(not what I wanted)
/cars/" class="inactive">(not what I wanted)
/cars/" class="inactive">(not what I wanted)
/cars/" rel="nofollow">(not what I wanted)
/cars/?layout=gallery" rel="nofollow">(not what I wanted)
/cars/2001-ford-escort-great-condition/1235588">(IS what I wanted)

```

Where am I messing up here guys? Thx

Answer: 
Do not remove array's element *inside* foreach statement
Remember elements to delete in foreach, delete them after foreach:

```
$elements_to_delete = {};
foreach ($link_body as $key => $unfinished_link)
{

    if(stristr($unfinished_link, "inactive" OR "nofollow") === TRUE) {   

        $elements_to_delete.push($key);
    }
}

// removing elements after foreach complete
foreach($key in $elements_to_delete){
    $link_body[$key];
}

```
To my knowledge, you cannot combine parameters in the way you try here :

```
if(stristr($unfinished_link, "inactive" OR "nofollow") === TRUE)

```

Instead, you can replace with 

```
if(stristr($unfinished_link, "nofollow") === TRUE) || stristr($unfinished_link, "inactive") === TRUE)

```