$images_extensions = ['txt'];
$dir = 'messages';
$f = array_slice(scandir($dir), 2);
foreach($f as $r){
$e = fopen($r, 'r');
$w = fread($e, filesize($dir));
$file_extension = strtolower(substr($r, strrpos($r, '.')+1));
if (!in_array($file_extension, $images_extensions)) continue;
echo $w . '<br />';
}
echo '<form action = "index.php" method = "post">';
echo 'Ваше имя: <input type = "text" name = "name" />';
echo 'Ваш возраст: <input type = "text" name = "age" />';
echo '<input type = "submit" />';
echo '</ form>';
ошибка:Warning: fread(): Length parameter must be greater than 0 in W:\domains\test.ru\index.php on line 7