Last active
February 16, 2017 12:56
-
-
Save NinnaP/04b0d3f5c80d26ad7d094953c209bb58 to your computer and use it in GitHub Desktop.
Word Mapping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$input = trim(fgets(STDIN)); | |
$input = urldecode($input); | |
$input = iconv('UTF-8', 'ISO-8859-1//IGNORE', $input); | |
$input = strtolower($input); | |
$input =str_replace('input=', '', $input); | |
$input = array_count_values(str_word_count($input,1)); | |
echo "<table border='2'>"; | |
foreach ($input as $sample => $counter) { | |
echo "<tr>"; | |
echo "<td>" . $sample . "</td>"; | |
echo "<td>" . $counter . "</td>"; | |
echo "</tr>"; | |
} | |
echo "</table>"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment