Ejemplo n.º 1
0
function testMode($newsid, $count)
{
    $start = time();
    $per = 0;
    for ($i = 0; $i < $count; $i++) {
        $now = time();
        testOne($newsid);
        //usleep(mt_rand(1000,10000));
        $per++;
        if ($now - $start == 1) {
            printf("tps: " . $per . "  Send request: {$i}  \n");
            $per = 0;
            $start = $now;
        }
        //echo $now."  ".$start."  $per \n";
    }
    $end = time();
    return $end - $start;
}
    echo "\n";
    echo "\nSimple iteration after unset:\n";
    foreach ($class as $key => $value) {
        echo "    {$key}\n";
    }
    echo "\nisset first? ";
    var_dump(isset($class->first));
    echo "isset second? ";
    var_dump(isset($class->second));
    echo "isset third? ";
    var_dump(isset($class->third));
    echo "isset fourth? ";
    var_dump(isset($class->fourth));
    echo "\n";
}
function testTwo()
{
    echo "--- Secondary test ---\n";
    $class = new ArrayClass();
    foreach ($class as $key => $value) {
        echo "    {$key}\n";
    }
    echo "--\n";
    unset($class->first);
    foreach ($class as $key => $value) {
        echo "    {$key}\n";
    }
}
testOne('first');
testOne('fourth');
testTwo();