tick проблем

0 отговора 45 прегледа
#1

tick проблем

Значи исках да ползвам tick-ове теоритично: "Това е event който се случва на всеки N конструкции от ниско ниво изпълнени
от парсера във вътрешноста на declare блок , стойноста на N се сетва чрез ticks=N във заглавната
част на declare блок-а" - теоритично нещата са горе долу ясни - но защо този примерен код "размазва"
Apache-то ?

<?php
// A function that records the time when it is called
function profile ($dump = FALSE)
{
static $profile;

// Return the times stored in profile, then erase it
if ($dump) {
$temp = $profile;
unset ($profile);
return ($temp);
}

$profile[] = microtime ();
}

// Set up a tick handler
register_tick_function("profile");

// Initialize the function before the declare block
profile ();

// Run a block of code, throw a tick every 2nd statement
declare (ticks=2) {
for ($x = 1; $x < 50; ++$x) {
echo similar_text (md5($x), md5($x*$x)), "<br />;";
}
}

// Display the data stored in the profiler
print_r (profile (TRUE));
?>



Отговор