100500 ? , . , , , - . , ? . 03.02.2013, 20:16 $lines = file('file.txt'); - . - $cnt = count($lines); - $rand = rand(0, ($cnt-1)); - 0, 1 , . echo trim($lines[$rand]); - ? , , . 1 . , , . , , . . <?php session_start(); // . $lines = file('file.txt'); $cnt = count($lines); if (!isset($_SESSION['lines'])) { $_SESSION['lines'] = array(); } $i = 1; do { if ($i > $cnt)// $cnt( ) , , , . { $stop = 1; break; } $rand = rand(0, ($cnt-1)); $line = trim($lines[$rand]); $i++; } while (in_array($line, $_SESSION['lines']));// - :) if (!isset($stop)) { echo $line; // $_SESSION['lines'][] = $line; } ?> , 10 , . , . , , . 500 . 100 . 20%. //////////////////////////////////////////// ? <?php function name($1, $2=0) { echo $2; } name(); ?> :-:-:-::-:-:-::-:-:-::-:-:-::-:-:-::-:-:-::-:-:-: ? headr.php ( ) : <? $start_time = microtime(); // $start_array = explode(" ",$start_time); // $start_time = $start_array[1] + $start_array[0]; // ?> --------------------------- foot.php ( ): <? $end_time = microtime(); $end_array = explode(" ",$end_time); $end_time = $end_array[1] + $end_array[0]; $time = $end_time - $start_time; printf(" %f ",$time); ?> ------------ <? \\\\start.php //
назад далее
перейти
в начало
В библиотеку

на главную



..
(c) xika.ru