PHP Classes

PHP IP Sorter: Sort an array of IP addresses

Recommend this page to a friend!
  Info   View files Example   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
StarStar 34%Total: 306 All time: 7,327 This week: 425Up
Version License PHP version Categories
sorterip 1.0GNU General Publi...3.0Networking, Algorithms, PHP 5


This class can sort an array of IP addresses.

It takes a list of IP v4 addresses and sorts them considering the numbers of its parts separated by dots starting from the first part number.

The class returns the same array with the address elements already sorted.

The sorting algorithm may be overridden providing a callback function to implement a different algorithm.

Innovation Award
PHP Programming Innovation award nominee
September 2014
Number 5

Prize: One downloadable copy of Komodo IDE
Some applications need to group IP addresses according to the networks they belong.

One solution for this problem is to sort the list of IP addresses, so addresses of the same network appear in the list together.

This class can sort a list of IP addresses considering the values of each part of the whole IP address.

Manuel Lemos
Picture of Luca Pacchiarotta
  Performance   Level  
Name: Luca Pacchiarotta is available for providing paid consulting. Contact Luca Pacchiarotta .
Classes: 1 package by
Country: Italy Italy
Age: ???
All time rank: 3797153 in Italy Italy
Week rank: 483 Up21 in Italy Italy Up
Innovation award
Innovation award
Nominee: 1x

+-------------------------------------+ | Sorter IP | v 1.0 | +-------------------------------------+ Sorter IP It's a PHP class to sort a list of IP addresses. Luca Pacchiarotta luca450mhz at inwind dot it
  Files folder image Files  
File Role Description
Accessible without login Plain text file demo.php Example A demo script
Accessible without login Plain text file license.txt Lic. License
Accessible without login Plain text file readme.txt Data Readme
Plain text file SorterIP.php Class The primary class

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:7,327
This week:425Up
User Ratings User Comments (1)
 All time
$tmp1 = explode('.
8 years ago (Dima Zan)