Location: PHPKode > scripts > Prioritexter > Sort.php
<?php
class Sort {

  function keyWithMaxMinValue($arr,$direction="max") {
    if ($direction=="max") {
	  $maxMinValue = MIN_INT;
    } else {
	  $maxMinValue = MAX_INT;
    }

    foreach($arr as $key => $value) {
      if ($direction=="max") {
	if($value > $maxMinValue) {
	  $maxMinValue = $value;
	  $maxMinKey = $key;
	}
      } else {
	if($value < $maxMinValue) {
	  $maxMinValue = $value;
	  $maxMinKey = $key;
	}
      }
    }
    return ($maxMinKey);
  }

  function maxMinValue($arr,$direction="max") {
    return ($arr[Sort::keyWithMaxMinValue($arr,$direction)]);
  }



}
?>
Return current item: Prioritexter