extract IP address from content

<?php

function extractIpAddr($filename,$sort = "ASC"){

$lines = file($filename, FILE_IGNORE_NEW_LINES);
 $ArrayList = array();

foreach($lines as $line){
 $isMatched = preg_match_all("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $line, $matches);
 if($isMatched){
 foreach($matches[0] as $match){
 array_push($ArrayList, $match);
 }
 }
 }
 $rs = array_unique($ArrayList);
 ($sort == "ASC")?asort($rs):arsort($rs);
 return $rs;
}

$filename = "network-omniconnect.com.au.txt";
$iplist = extractIpAddr($filename,"DESC");

echo implode($iplist, "\n");

?>

content parsing with simplexml_import_dom

$doc = new DOMDocument();
$doc->loadHTML($this->view->content);
$xml = simplexml_import_dom($doc); // just to make xpath more simple
$images = $xml->xpath(‘//img’);
$this->view->images = $images;

preg_match_all(‘/]+>/i’,$this->view->content, $result);

foreach($result as $img){
$this->view->content = str_replace($img, ”, $this->view->content);
}