0

Скажите, пожалуйста.

2
  • 3
    Попробуйте wc -l
    – VladD
    18 дек 2012 в 12:33
  • Это как можно скрипт
    – cas
    18 дек 2012 в 12:38

1 ответ 1

4
$array = file('file.txt');
echo count($array);
/*-------------------------------------------*/

$str = file_get_contents('file.txt');
echo substr_count($str "\n");

/*-------------------------------------------*/

$h = fopen('r','file.txt');
$count = 0;
while (!feof($h)) {
    fgets($h);
    $count++;
}
echo $count;

/*-------------------------------------------*/

trim(exec("wc -l file.txt"));

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.