src/Alg/Search/Interpolation.php
public function search( $list, $search )
	{
		$lowbound	= 0;									// lowbound - untergrenze
		$highbound	= sizeof( $list ) - 1;					// highbound - obergrenze
		do
		{
			$index = $this->calculateIndex( $list, $search, $lowbound, $highbound );
//			echo "[".$lowbound."|".$highbound."]  search_index: ".$index.": ".$list[$index]."<br>";
			if( $index < $lowbound || $index > $highbound )
				return -1;
			if( $list[$index] == $search )
				return $index;
			if( $list[$index] < $search )
				$lowbound	= $index+1;
			else
				$highbound	= $index-1;
		}
		while( $lowbound < $highbound );
		return -1;
	}
public function search( $list, $search )
	{
		$lowbound	= 0;									// lowbound - untergrenze
		$highbound	= sizeof( $list ) - 1;					// highbound - obergrenze
		do
		{
			$index = $this->calculateIndex( $list, $search, $lowbound, $highbound );
//			echo "[".$lowbound."|".$highbound."]  search_index: ".$index.": ".$list[$index]."<br>";
			if( $index < $lowbound || $index > $highbound )
				return -1;
			if( $list[$index] == $search )
				return $index;
			if( $list[$index] < $search )
				$lowbound	= $index+1;
			else
				$highbound	= $index-1;
		}
		while( $lowbound < $highbound );
		return -1;
	}
public function search ( $ list , $ search ) { $ lowbound = 0 ; // lowbound - untergrenze
 $ highbound = sizeof ( $ list ) - 1 ; // highbound - obergrenze
 do { $ index = $ this -> calculateIndex ( $ list , $ search , $ lowbound , $ highbound ) ; //			echo "[".$lowbound."|".$highbound."]  search_index: ".$index.": ".$list[$index]."<br>";
 if ( $ index < $ lowbound || $ index > $ highbound ) return - 1 ; if ( $ list [ $ index ] == $ search ) return $ index ; if ( $ list [ $ index ] < $ search ) $ lowbound = $ index + 1 ; else $ highbound = $ index - 1 ; } while ( $ lowbound < $ highbound ) ; return - 1 ; }
Searches in List and returns position if found, else -1.
@access		public
@param		array		$ist			List to search in
@param		mixed		$search			Element to search
@return 	int
Searches in List and returns position if found else - 1 .