获得foreach循环结果的最大值

I am trying to get the result with the largest number in a substring from a foreach loop. The code below returns 2 strings which only differ as one contains a substring of "220px" the other a substring of "24px". I'd like to return as a variable "220" or the highest number in any number of substrings. I used "simple_html_dom.php" from http://simplehtmldom.sourceforge.net/. Any assistance is much appreciated.

<html>
<body>
<h2>Search</h2>
<form method="post">
Search: <input type="text" name="q" value="google"/>
<input type="submit" value="Submit">
</form>

<?php

include 'simple_html_dom.php';  

if (isset($_POST['q'])) {
$search = $_POST['q']; 
$html = file_get_html("http://en.wikipedia.org/wiki/$search");
?>
<h2>Search results for '<?php echo $search; ?>'</h2>
<ol>

<?php

foreach ($html->find('img') as $element): ?>


<?php $photo = $element->src;
$logo = 'Logo';

if(strpos($photo, $logo)) 
{

if (preg_match_all('/[0-9]+px/', $photo, $result)) {
echo '<br/>';

$rp = trim($result[0][0],"px") .'<br/>';
echo $photo;

} else {
echo "Not found";
}
} 

?>              

<?php endforeach;?>
</ol>
<?php 
}

?>
</body>
</html>

Heres some code for a foreach that your trying to obtain.

$highest = 0;
foreach($array as $string) {
   $number = intval($string);
   if($number > $highest) {
       $highest = $number
   }
}

// highest is now the highest number gotten from the strings of the foreach loop