PHP Classes

File: demo.php

Recommend this page to a friend!
  Classes of Luca Pacchiarotta   PHP IP Sorter   demo.php   Download  
File: demo.php
Role: Example script
Content type: text/plain
Description: A demo script
Class: PHP IP Sorter
Sort an array of IP addresses
Author: By
Last change:
Date: 10 years ago
Size: 1,455 bytes
 

Contents

Class file image Download
<?php

//
// +---------------------------------------------+
// | SORTER IP | V1.0 |
// | http://www.SysTurn.com |
// +---------------------------------------------+
//
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
//

include_once ('SorterIp.php');

$ip1 = array('ip' => '192.168.10.1');
$ip2 = array('ip' => '192.168.10.10');
$ip3 = array('ip' => '10.0.0.10');
$ip4 = array('ip' => '10.0.0.5');
$ip5 = array('ip' => '176.10.0.90');
$ip6 = array('ip' => '176.18.10.1');
$ip7 = array('ip' => '132.18.19.128');

$list = array();
$i = 0;
for (
$i = 1; $i < 8; $i++) {
   
$var = "ip$i";
   
$list[$i] = $$var;
}

$objSorter = new SorterIP();
$data = $objSorter -> sort($list);
var_dump($data);

?>