но при уменьшении размера окна, придется каждый шаг обрабатывать медазапросами, т.к. линии наезжают на заголовок)
.header {
height: 500px;
background: url(../img/header_bg.png) no-repeat;
background-position: center center;
}
function cmp($a, $b) {
if ($a == $b) {
return 0;
}
return ($a < $b) ? -1 : 1;
};
$cmp_callback = function($a, $b) {
if ($a == $b) {
return 0;
}
return ($a < $b) ? -1 : 1;
};
$count = 100000;
$time = microtime(true);
for ($i = 0; $i < $count; $i++) {
$arr = [9, 7, 1, 5, 7, 12, 3, 9, 2];
usort($arr, function ($a, $b) {
if ($a == $b) {
return 0;
}
return ($a < $b) ? -1 : 1;
});
}
$time = microtime(true) - $time;
echo "Time (callback function): {$time}" . PHP_EOL;
$time = microtime(true);
for ($i = 0; $i < $count; $i++) {
$arr = [9, 7, 1, 5, 7, 12, 3, 9, 2];
usort($arr, 'cmp');
}
$time = microtime(true) - $time;
echo "Time (function declaration): {$time}" . PHP_EOL;
$time = microtime(true);
for ($i = 0; $i < $count; $i++) {
$arr = [9, 7, 1, 5, 7, 12, 3, 9, 2];
usort($arr, $cmp_callback);
}
$time = microtime(true) - $time;
echo "Time (function expression): {$time}" . PHP_EOL;