Find how many times each word appeared in string in php

I have an HTML form with a comment box textarea. I want to be able to count how many words were input (which I have done with str_word_count then I want to be able to tell the user how many times each word appeared in the string. I can print the values like this Array ( [I] => 1 [like] => 1 [comments] => 1 ) but how would I output into a 2 column table where it shows the word and the count?

Thanks for any help!

Form Code:

<html>
<head>
  <title>PHP Form</title>
</head>

<body>
  <form name="newForm" method="post" action="formProcess.php">UserName:
    <input type="text" name="userName" size="15" maxlength="15">
    <br>Password:
    <input type="password" name="pass1" size="15">
    <br>Confirm Password:
    <input type="password" name="pass2" size="15">
    <br>
    <p>I agree to the terms and conditions.
      <br>
      <input type="radio" name="terms" value="yes">Yes
      <input type="radio" name="terms" value="no">No
      <p>Enter comments here:
        <br>
        <textarea name="comments" rows="6" cols="50" wrap="physical"></textarea>
        <p>
          <input type="submit" name="submitForm">
          <input type="reset" name="resetForm">
        </p>
  </form>
</body>

</html>

read more

Angular: filtering on selected option and user entered value

I have a need to filter on a dataset. My form will look something like this:

<select>
    <option>Age</option>
    <option>CustomerID</option>
    <option>ProductID</option>
<select>

<input type="text" name="select-option-value">

What I want to achieve is the user selects an option, say age for example. Then enter a value for age in the input box. Only when an option and value has been entered in the input box will the filtering be performed on both of these form elements.

read more