$text = $data['book_description']; $max_length = 2300; $book_per_page = (isset($_GET['rowstart']) ? $_GET['rowstart'] : 1); // Разбиваем $text на массив $arr[], находя в тексте пробелы между словами $text.= ' '; while (!empty($text)): if (strlen($text)>$max_length) $n = $max_length; else $n = strlen($text); for ($i = $n-1; $i>0; $i--) if ($text[$i]==' ') break; $arr[] = trim(substr($text,0,$i+1)); $text = substr($text,$i+1); endwhile; $k = count($arr); // Выводим на экран текущую страницу echo 'Страница '.$book_per_page.' из '.$k.'

'; echo $arr[$book_per_page-1];