Login   Register  
PHP Classes
elePHPant
Icontem

File: index.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Raj Kumar Trivedi  >  Sort MD Array  >  index.php  >  Download  
File: index.php
Role: Example script
Content type: text/plain
Description: example.php
Class: Sort MD Array
Sort bidimensional arrays
Author: By
Last change:
Date: 5 years ago
Size: 1,481 bytes
 

Contents

Class file image Download
<?php
include("arraySort.php");
$start_data = array(
  array(
'first_name' => 'Raj''last_name' => 'Trivedi''age' => 26),
  array(
'first_name' => 'Parul''last_name' => 'Trivedi''age' => 26),
  array(
'first_name' => 'Rahul''last_name' => 'Trivedi''age' => 22),
  array(
'first_name' => 'Raghuvansh''last_name' => 'Trivedi''age' => 22),
  array(
'first_name' => 'Gaurav''last_name' => 'Trivedi''age' => 21),
  array(
'first_name' => 'Garima''last_name' => 'Trivedi''age' => 17),
  array(
'first_name' => 'Neha''last_name' => 'Agrawal''age' => 26),
  array(
'first_name' => 'Shweta''last_name' => 'Agrawal''age' => 25),
  array(
'first_name' => 'Iti''last_name' => 'Agrawal''age' => 24),
);
$arrSort = new sortMultiDiArray($start_data,'first_name','asc');
$returnArray $arrSort->sortArray();
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE>+++++++++++ Sort MD Array +++++++++++</TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
 </HEAD>
 <BODY>
<table border="0" width="100%">  
    <tr>
        <td>
        Array:
            <?php 
                
echo "<pre>";
                    
print_r($start_data);
                echo 
"</pre>";
            
?>
        </td>
        <td>
        Array after sort First Name:
            <?php 
                
echo "<pre>";
                    
print_r($returnArray);
                echo 
"</pre>";
            
?>
        </td>
    </tr>    
</table>
 </BODY>
</HTML>