Ejemplo n.º 1
0
    urldecode($string_1e);
}
$timer->stop(memory_get_usage(true), 'urldecode');
$timer->start(memory_get_usage(true));
for ($i = 0; $i < $run_times; $i++) {
    addslashes($string_9);
}
$timer->stop(memory_get_usage(true), 'addslashes');
$string_9e = addslashes($string_9);
$timer->start(memory_get_usage(true));
for ($i = 0; $i < $run_times; $i++) {
    stripslashes($string_9e);
}
$timer->stop(memory_get_usage(true), 'stripslashes');
echo $head . "\n" . str_pad("Total", 23) . " : " . number_format($timer->totalTime, 3) . " sec</pre>\n";
echo $head . "\n" . $timer->convert($timer->totalMemory);
exit;
// all done
class benchmarkTimer
{
    public $startTime;
    public $startMemory;
    public $totalMemory = 0;
    public $totalTime = 0;
    public function start($memory)
    {
        // use this method, because old php 4.x branches do not support the parameter to return a float
        list($usec, $this->string_ec) = explode(" ", microtime());
        $this->startTime = (double) $usec + (double) $this->string_ec;
        $this->startMemory = $memory;
        echo "start " . $this->startMemory . " \n";