function test_search_UnsortedCompare()
 {
     $a =& $this->_getArray();
     for ($i = 0; $i < $this->_attempts; ++$i) {
         $n = mt_rand(0, $this->_elements - 1);
         $search_term = $a[$n];
         $rv = fbBinarySearch_Array::search($search_term, $a, true, 'fbBinarySearch_Array_compare');
         $this->assertEquals($search_term, $a[$rv]);
     }
 }
</tr>

<tr>
<td>
&nbsp;
</td>
<td>
<input type="submit" value="Submit" name="btn_submit" />
</td>
</tr>

</table>
</form>
<?php 
for ($i = 0; $i < $attempts; ++$i) {
    $n = rand(0, $elements - 1);
    $search_term = $a[$n];
    printf("Searching for '%s' (element   %s)\n", $search_term, $n);
    $rv = fbBinarySearch_Array::search($search_term, $a, false);
    printf("Found         '%s' at element %s\n", $search_term, $rv);
    assert('$a[$rv] == $search_term');
}
?>
<address>
$CVSHeader: _freebeer/www/demo/Binary_Search.Array.php,v 1.2 2004/03/07 17:51:33 ross Exp $
</address>

</body>
</html>