Beispiel #1
0
function Test()
{
    $t = new HashTable();
    $text = "YEAR OF GLAD. I am seated in an office, surrounded by heads and bodies. My posture is consciously congruent to the shape of my hard chair. This is a cold room in University Administration, wood-walled, Remington-hung, double-windowed against the November heat, insulated from Administrative sounds by the reception area outside, at which Uncle Charles, Mr. deLint and I were lately received.";
    $arr = explode(" ", $text);
    foreach ($arr as $item) {
        $item = (string) $item;
    }
    for ($i = 0; $i < sizeof($arr); $i++) {
        $t->set($arr[$i], $i);
    }
    $res = array();
    foreach ($arr as $item) {
        array_push($res, $t->get($item));
    }
    print_r($res);
    for ($i = 0; $i < 10; $i++) {
        $t->remove($arr[$i]);
    }
    foreach ($arr as $item) {
        array_push($res, $t->get($item));
    }
    print_r($res);
}