PHP Classes

How to Use a PHP WordList Class to Compare Lists of Words on a Web Page Using the Package Word List Comparator: Compares and manipulates lists of words

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2025-08-13 (15 days ago) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
word-list-comparator 1.0GNU Lesser Genera...7Algorithms, Tools, Text processing, P...
Description 

Author

This package compares and manipulates lists of words.

It provides a class that can take two lists of words as a single string and split the words into arrays to compare the word lists.

The class returns a report in an array, listing the words that are repeated and their positions in the parameter word list strings.

The package can also:

- Unify the two lists of words

- Create a file of common words in the two lists

The package also provides a Web page that uses the class to provide a tool for comparing two lists of words.

Picture of Roberto Aleman
  Performance   Level  
Name: Roberto Aleman <contact>
Classes: 32 packages by
Country: Venezuela Venezuela
Age: 51
All time rank: 1391 in Venezuela Venezuela
Week rank: 195 Down2 in Venezuela Venezuela Down
Innovation award
Innovation award
Nominee: 20x

Winner: 3x

Instructions

Please read this document to learn how to use the ListComparator class to compare word lists and get an analysis report.

Documentation

Word List Comparator

Author: Roberto Aleman, ventics.com

A simple and efficient web tool for comparing two lists of words. It allows users to identify common, exclusive, and duplicate words, and offers the option to generate new, unified lists.

? Key Features

  • User-Friendly Interface: Allows users to upload text files or paste word lists directly.
  • Comprehensive Analysis: Provides a detailed report that includes: Internally Duplicated Words*: Identifies words that are repeated within each list. Exclusive Words*: Shows words that are only in List 1 or only in List 2. Common Words*: Lists words that appear in both lists, indicating their first position and number of repetitions.
  • Data Normalization: Performs case-insensitive comparisons and cleans content by removing whitespace and empty lines.
  • File Generation: Allows the creation of a text file (`newlist.txt`) with words found in both lists.
  • List Unification: Offers the option to display a unified list with all unique words from both lists.

? How to Use

Simply upload the index.php and ListComparator.php files to the same folder on your web server. Then, open index.php in your browser.

  1. Enter Lists: You can choose one of two options to input your data: Upload Files*: Use the "upload a text file" fields to select two files from your computer. Copy and Paste*: Paste the words directly into the provided text areas.
  2. Configure Options: Check the boxes according to your needs: * `Unify lists with unique occurrences`: Displays a list with all unique words from both lists. * `Create a new file with common words`: Generates a file named `newlist.txt` with words found in both lists.
  3. Compare: Click the `Compare Lists` button to run the analysis. The results will be displayed directly on the web page.

?? Project Structure

  • `index.php`: Contains the user interface (HTML) and the logic to process form data. This is the main file users interact with.
  • `ListComparator.php`: Defines the `ListComparator` class, which encapsulates all the business logic: data normalization, list comparison, repetition counting, and the creation of the new text file.

? License

This project is released under the GNU AFFERO GENERAL PUBLIC LICENSE.


  Files folder image Files (4)  
File Role Description
Plain text file index.php Appl. Tool application script
Plain text file LICENSE Lic. License text
Plain text file ListComparator.php Class Class source
Plain text file README.md Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads  
 100%
Total:0
This week:0