Показать сообщение отдельно

  #9  
Старый 17.03.2009, 00:58
PandoraBox
Постоянный
Регистрация: 06.05.2007
Сообщений: 393
Провел на форуме:
1510937

Репутация: 398
По умолчанию

кто знает как оптиимизировать
PHP код:
<?php

/*
    Test logo :)
    Copyright (c) 2009, Denis aka Pandora.
*/

    
error_reporting(0);

    function 
micro_time() {
        
$temp explode(" "microtime());
        return 
bcadd($temp[0], $temp[1], 6);
    }

    
$time_start micro_time();

    
$now time();
    
$min_timeout time() - (60 15);

    
$images = array('image1.jpg''image2.jpg''image3.jpg''image4.jpg');
    
$temp_file "C:\logo_time";

    
$file_time = @fileatime($temp_file);
    
$image_loc = @file($temp_file);

    if (!
file_exists($temp_file) || !isset($file_time))
    {
        
$f fopen($temp_file"w+");
        
fwrite($f, (isset($image_loc[0]) ? $image_loc[0] : $images[0]));
        
fclose($f);
        
touch($temp_file);
    }
    elseif ((
$file_time >= $min_timeout) && isset($file_time))
    {
        
$image_set $images[0];
        
$count_images count($images)-1;
        
$i=0;
        foreach (
$images as $image)
        {
            if (
$image == $image_loc[0] && ($i $count_images))
            {
                
$image_set $images[$i+1];
                break;
            }
            
$i++;
        }
        unset(
$images$count_images);
        
$f fopen($temp_file"w+");
        
fwrite($f, (isset($image_set) ? $image_set $images[0]));
        
fclose($f);
        
touch($temp_file$min_timeout$min_timeout);
    }
    unset(
$temp_file$image_loc$file_time$images$now$min_timeout);
    
$time_stop micro_time();
    
$time_overall bcsub($time_stop$time_start6);
    echo 
"<p>Execution time - $time_overall Seconds</p>";

?>
 
Ответить с цитированием