Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (isset($_GET['input']) && !empty($_GET['input'])) {
- $inputText = trim(strtolower($_GET['input']));
- $inputText = preg_replace('/\s+/', ' ', $inputText); // Заменяме всички whitespace с един space
- $text = explode(" ", $inputText);
- $text = preg_replace('/[^A-Za-z\-]/', '', $text);
- $result;
- foreach ($text as $word) {
- if (!($word == "")) {
- $result[] = $word;
- }
- }
- $output = array_count_values($result);
- ?>
- <table border='2'><?php foreach ($output as $key => $value) : ?>
- <tr><td><?= $key ?></td><td><?= $value ?></td></tr><?php endforeach;
- } ?></table>
Advertisement
Add Comment
Please, Sign In to add comment