I have this function to extract links and their descriptions
function extract_links($string) {
preg_match_all("/(href[= = ])(.*?)(>)(.*?)(<\/a>+)/i",$string, $matches);
for($i=0; $i<count($matches); $i++) {
if($i == 2) {
for($x=0; $x<count($matches[$i]); $x++) {
$return['url'][$x] = eregi_replace("^\"|\"$","",$matches[$i][$x]);
}
}
if($i == 4) {
for($x=0; $x<count($matches[$i]); $x++) {
$return['link_text'][$x] = $matches[$i][$x];
}
}
}
if(is_array($return)) {
return $return;
} else {
return FALSE;
}
}
$links = extract_links($html)
this function return arrays:
$links[link_text][$i]
$links[url][$i]
I have this search/delete function to delete values from array, which contain specific word
function array_delete($array, $filterfor){
$thisarray = array ();
foreach($array as $value)
if(stristr($value, $filterfor)===false && strlen($value)>0)
$thisarray[] = $value;
return $thisarray;
}
$links['url']=array_delete($links['url'], "someword");
So I know, how to delete value from each array separately, but when I delete url from one array, there is still description in the second array and obversely.
Please, help me to find way, how to delete both related entries together
GoodWill