Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8" />
- <title>Замена</title>
- </head>
- <body>
- <?php
- /**
- * В этой переменно у нас хранится оригинальный переданый текст
- */
- $text = '';
- /**
- * Если нажата кнопка Добавить
- */
- if (isset($_POST['add'])) {
- $text = strip_tags(trim($_POST['txt']));
- $text = mb_strtolower($text, "UTF-8");
- $clean = preg_replace('/[!~`@|.,:;?&)(\"><№#\\\%\\/^\'*$_]/u', '', $text);
- // echo $clean; НЕ БУДЕМ ПОКАЗЫВАТЬ ОЧИЩЕННЫЙ ТЕКСТ
- $massiv = explode(" ", $clean);
- // echo $text;
- print_r(array_count_values($massiv));
- }
- /**
- $text = preg_replace('/#[^a-zа-яё-]#i/u', '', $text);
- $text = preg_replace('/\s\s+/', ' ', $text); УДАЛЯЕТ ЛИШНИЕ ПРОБЕЛЫ
- */
- ?>
- <form method="post">
- Введите текст:<br/>
- <textarea cols="40" rows="10" name="txt"><?php echo $text; ?></textarea><br/>
- <input type="submit" name="add" value="Добавить" />
- <div>
- </div>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement