new to php and at a roadblock on this question : <p>Write a small program to calculate all the word frequency in the any given link, and print the result with frequency sort by alphabet.</p>

<p>For example, a link has an article like this: "what makes a developer bad, what makes a them good," the result should be:
a 1
bad 1 
developer 1
good 1 
makes 2
them 1
what 2</p>

<p>New to php and at a roadblock. What i have so far:</p>

<pre><code>&lt;h2&gt;PHP Form Validation Example&lt;/h2&gt;
&lt;p&gt;&lt;span class="error"&gt;* required field&lt;/span&gt;&lt;/p&gt;
&lt;form method="post" action="&lt;?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?&gt;"&gt;  
  Name: &lt;input type="text" name="name" value="&lt;?php echo $name;?&gt;"&gt;
  &lt;span class="error"&gt;* &lt;?php echo $nameErr;?&gt;&lt;/span&gt;
  &lt;br&gt;&lt;br&gt;

  &lt;input type="submit" name="submit" value="Submit"&gt;  
&lt;/form&gt;


&lt;?php
// define variables and set to empty values
$nameErr = "";
$name = "";

if ($_SERVER["REQUEST_METHOD"] == "POST") {
  if (empty($_POST["name"])) {
    $nameErr = "Name is required";
  } else {
    $name = test_input($_POST["name"]);
  }
}

function test_input($data) {
  $data = trim($data);
  $data = stripslashes($data);
  $data = htmlspecialchars($data);
  return $data;
}


?&gt;

&lt;?php
echo("$name");
?&gt; 
</code></pre>
