Login   Register  
PHP Classes
elePHPant
Icontem

File: array_sort_example2.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Matthias Rothe  >  Advanced Array Sort  >  array_sort_example2.php  >  Download  
File: array_sort_example2.php
Role: Example script
Content type: text/plain
Description: Example of the Class in Use (Outputs Error Msgs)
Class: Advanced Array Sort
Sorts multidimensional arrays by multiple columns
Author: By
Last change: adjusted for better output reading in html browsers
Date: 2005-05-21 03:51
Size: 6,839 bytes
 

Contents

Class file image Download
<?
$test_array 
= array(=> array(    => "00016",
                                
=> array("tbl_txt""Allianz"),
                                
=> array("tbl_txt""DE0008404005"),
                                
=> array("tbl_txt""22"),
                                
=> array("tbl_txt""2005-04-29"),
                                
=> array("tbl_txt""91.40"),
                                
=> array("tbl_txt_pos""92.25"),
                                
=> array("tbl_txt_pos""0.93")),
                    
=> array(    => "00001",
                                
=> array("tbl_txt""Arcelor S.A."),
                                
=> array("tbl_txt""LU0140205948"),
                                
=> array("tbl_txt""187"),
                                
=> array("tbl_txt""2005-04-14"),
                                
=> array("tbl_txt""17.10"),
                                
=> array("tbl_txt_neg""15.50"),
                                
=> array("tbl_txt_neg""-9.36")),
                    
=> array(    => "00001",
                                
=> array("tbl_txt""Arcelor S.A."),
                                
=> array("tbl_txt""LU0140205948"),
                                
=> array("tbl_txt""406"),
                                
=> array("tbl_txt""2005-02-17"),
                                
=> array("tbl_txt""18.80"),
                                
=> array("tbl_txt_neg""15.50"),
                                
=> array("tbl_txt_neg""-17.55")),
                    
=> array(    => "00017",
                                
=> array("tbl_txt""BASF"),
                                
=> array("tbl_txt""DE0005151005"),
                                
=> array("tbl_txt""40"),
                                
=> array("tbl_txt""2005-04-29"),
                                
=> array("tbl_txt""49.98"),
                                
=> array("tbl_txt_pos""50.05"),
                                
=> array("tbl_txt_pos""0.14")),
                    
=> array(    => "00018",
                                
=> array("tbl_txt""EADS"),
                                
=> array("tbl_txt""NL0000235190"),
                                
=> array("tbl_txt""100"),
                                
=> array("tbl_txt""2005-04-29"),
                                
=> array("tbl_txt""22.02"),
                                
=> array("tbl_txt_pos""22.03"),
                                
=> array("tbl_txt_pos""0.05")),
                    
=> array(    => "00007",
                                
=> array("tbl_txt""Elringklinger AG NA O.N."),
                                
=> array("tbl_txt""DE0007856023"),
                                
=> array("tbl_txt""100"),
                                
=> array("tbl_txt""2005-02-17"),
                                
=> array("tbl_txt""69.15"),
                                
=> array("tbl_txt_neg""57.20"),
                                
=> array("tbl_txt_neg""-17.28")),
                    
=> array(    => "00005",
                                
=> array("tbl_txt""Fuchs Petrolub Vz."),
                                
=> array("tbl_txt""DE0005790430"),
                                
=> array("tbl_txt""103"),
                                
=> array("tbl_txt""2005-04-29"),
                                
=> array("tbl_txt""65.12"),
                                
=> array("tbl_txt_pos""67.58"),
                                
=> array("tbl_txt_pos""3.78")),
                    
=> array(    => "00005",
                                
=> array("tbl_txt""Fuchs Petrolub Vz."),
                                
=> array("tbl_txt""DE0005790430"),
                                
=> array("tbl_txt""103"),
                                
=> array("tbl_txt""2005-02-17"),
                                
=> array("tbl_txt""75.00"),
                                
=> array("tbl_txt_neg""67.58"),
                                
=> array("tbl_txt_neg""-9.89")),
                    
=> array(    => "00019",
                                
=> array("tbl_txt""Postbank"),
                                
=> array("tbl_txt""DE0008001009"),
                                
=> array("tbl_txt""55"),
                                
=> array("tbl_txt""2005-04-29"),
                                
=> array("tbl_txt""36.30"),
                                
=> array("tbl_txt_neg""36.25"),
                                
=> array("tbl_txt_neg""-0.14")),
                    
=> array(    => "00020",
                                
=> array("tbl_txt""SOFTWARE AG O.N."),
                                
=> array("tbl_txt""DE0003304002"),
                                
=> array("tbl_txt""75"),
                                
=> array("tbl_txt""2005-04-29"),
                                
=> array("tbl_txt""26.83"),
                                
=> array("tbl_txt_neg""26.44"),
                                
=> array("tbl_txt_neg""-1.45")),
                    
10 => array(=> "00008",
                                
=> array("tbl_txt""Sartorius AG VZO O.N."),
                                
=> array("tbl_txt""DE0007165631"),
                                
=> array("tbl_txt""343"),
                                
=> array("tbl_txt""2005-02-18"),
                                
=> array("tbl_txt""16.71"),
                                
=> array("tbl_txt_pos""17.00"),
                                
=> array("tbl_txt_pos""1.74")),
                    
11 => array(=> "00001",
                                
=> array("tbl_txt""Arcelor S.A."),
                                
=> array("tbl_txt""LU0140205948"),
                                
=> array("tbl_txt""187"),
                                
=> array("tbl_txt""2005-04-14"),
                                
=> array("tbl_txt""17.10"),
                                
=> array("tbl_txt_neg""15.50"),
                                
=> array("tbl_txt_neg""9.36")));

$test_array_2 = array(=> array(=> "00016",
                                
=> "Allianz",
                                
=> "DE0008404005",
                                
=> "22",
                                
=> "2005-04-29",
                                
=> "91.40",
                                
=> "92.25",
                                
=> "0.93"),
                    
=> array(    => "00001",
                                
=> "Arcelor S.A.",
                                
=> "LU0140205948",
                                
=> "187",
                                
=> "2005-04-14",
                                
=> "17.10",
                                
=> "15.50",
                                
=> "-9.36"),
                    
=> array(    => "00001",
                                
=> "Arcelor S.A.",
                                
=> "LU0140205948",
                                
=> "406",
                                
=> "2005-02-17",
                                
=> "18.80",
                                
=> "15.50",
                                
=> "-17.55"),
                    
=> array(    => "00017",
                                
=> "BASF",
                                
=> "DE0005151005",
                                
=> "40",
                                
=> "2005-04-29",
                                
=> "49.98",
                                
=> "50.05",
                                
=> "0.14"),
                    
=> array(    => "00018",
                                
=> "EADS",
                                
=> "NL0000235190",
                                
=> "100",
                                
=> "2005-04-29",
                                
=> "22.02",
                                
=> "22.03",
                                
=> "0.05"),
                    
=> array(    => "00007",
                                
=> "Elringklinger AG NA O.N.",
                                
=> "DE0007856023",
                                
=> "100",
                                
=> "2005-02-17",
                                
=> "69.15",
                                
=> "57.20",
                                
=> "-17.28"),
                    
=> array(    => "00005",
                                
=> "Fuchs Petrolub Vz.",
                                
=> "DE0005790430",
                                
=> "103",
                                
=> "2005-04-29",
                                
=> "65.12",
                                
=> "67.58",
                                
=> "3.78"),
                    
=> array(    => "00005",
                                
=> "Fuchs Petrolub Vz.",
                                
=> "DE0005790430",
                                
=> "103",
                                
=> "2005-02-17",
                                
=> "75.00",
                                
=> "67.58",
                                
=> "-9.89"),
                    
=> array(    => "00019",
                                
=> "Postbank",
                                
=> "DE0008001009",
                                
=> "55",
                                
=> "2005-04-29",
                                
=> "36.30",
                                
=> "36.25",
                                
=> "-0.14"),
                    
=> array(    => "00020",
                                
=> "SOFTWARE AG O.N.",
                                
=> "DE0003304002",
                                
=> "75",
                                
=> "2005-04-29",
                                
=> "26.83",
                                
=> "26.44",
                                
=> "-1.45"),
                    
10 => array(=> "00008",
                                
=> "Sartorius AG VZO O.N.",
                                
=> "DE0007165631",
                                
=> "343",
                                
=> "2005-02-18",
                                
=> "16.71",
                                
=> "17.00",
                                
=> "1.74"));

require(
"array_sort.class.inc");
$array_sort = new array_sort($test_array"<[1][1]>|<[4][1]>|<[7][1]>");
if(!
$array_sort->error["flag"]){
  echo 
"\n<b>Sortierter Array:</b>\n<br>\n";
  echo 
"<p>\n<pre>\n";
  
print_r($array_sort->get_sorted_array());
  echo 
"\n</pre>\n</p>";
  }
else echo 
$array_sort->error["msg"];
?>