PHP Classes

PHP URL Compare: Compare two URLs and show the differences

Recommend this page to a friend!
  Info   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-01-09 (4 months ago) RSS 2.0 feedStarStarStarStar 62%Total: 411 All time: 6,479 This week: 673Up
Version License PHP version Categories
url-compare 1.9BSD License5.3PHP 5, Text processing


This class can compare two URLs and show the differences.

It can parse two given URLs and compare them to see if they are different.

The class ignores the order of query parameters so it can determine if the URLs are the same even if the order of the parameters is different.

It returns a string with the details of which parts of the URLs may be different.

Innovation Award
PHP Programming Innovation award nominee
October 2013
Number 5

Prize: One copy of the Zend Studio
Sometimes it is necessary to compare two URLs to determine if they represent the same page.

Comparing the URLs character by character may not be enough to determine if the URLs are different because they may represent the same URL with query parameters order switched.

This class can address that situation by parsing the URLs and comparing the query parameters one by one regardless of their order in the URLs.

Manuel Lemos
Picture of Yasir Siddiqui
  Performance   Level  
Name: Yasir Siddiqui is available for providing paid consulting. Contact Yasir Siddiqui .
Classes: 14 packages by
Country: Pakistan Pakistan
Age: 40
All time rank: 3143 in Pakistan Pakistan
Week rank: 94 Up2 in Pakistan Pakistan Up
Innovation award
Innovation award
Nominee: 8x

Winner: 1x


url-difference ============== This class can calculate difference between two Urls. Generally it is difficult to find differences between two long URLs containing key value pairs. You have to "eye-ball" each URL and find difference especially when two urls have different parameters ordering. See example.php for more details.

  Files folder image Files  
File Role Description
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file Doc. Documentation
Plain text file UrlDiffer.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:6,479
This week:673Up
 User Ratings  
 All time