Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PHp
02-25-2010, 06:45 AM
Post: #1
PHp
How can i Sort Multidimensional array using PHP??
Find all posts by this user
Quote this message in a reply
03-02-2010, 06:17 AM
Post: #2
RE: PHp
hi,

An array in PHP is actually an ordered map. A map is a type that associates values to keys. This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more. As array values can be other arrays, trees and multidimensional arrays are also possible.
..........................................................................................
Web designing Chennai | Website development company Chennai | Graphic designing companies Chennai
Find all posts by this user
Quote this message in a reply
03-04-2010, 01:38 PM
Post: #3
RE: PHp
Sorting Multidimensional Arrays

Life is a series of improbable events
Altro Enterprises
Visit this user's website Find all posts by this user
Quote this message in a reply
03-09-2010, 05:59 AM
Post: #4
RE: PHp
Thank u so much for your sharing i got it
Find all posts by this user
Quote this message in a reply
05-13-2010, 03:51 AM
Post: #5
RE: PHp
Using the following code we can sort multidimentinal array in php

<?php

// demo array to sort
$latest_array = array(
array('news','1234567890','sdf','asdpojq'),
array('news','1234567892','uruy','xbuqiwpo'),
array('comment','1234567893','fghj','mjktyu'),
array('article','1234567891','cvmo','pjklgg'),
array('news','1234567894','qwenb','asbhtyhj'),
);

$sort_field = 3; // enter the number of field to sort

// compare function
function cmpi($a, $b)
{
global $sort_field;
return strcmp($a[$sort_field], $b[$sort_field]);
}

// do the array sorting
usort($latest_array, 'cmpi');

// demo output
echo '<pre>';
print_r($latest_array);
echo '</pre>';

?>

sweatshirts | glass teaware | housewarming gifts
Find all posts by this user
Quote this message in a reply
05-27-2010, 12:49 AM
Post: #6
RE: PHp
PHP is a powerful tool for making dynamic and interactive Web pages.

PHP is the widely-used, free, and efficient alternative to competitors such as Microsoft's ASP.

In our PHP tutorial you will learn about PHP, and how to execute scripts on your server.
___________________________________
Whey Protein
Protein Supplements
Find all posts by this user
Quote this message in a reply
07-08-2010, 11:41 PM
Post: #7
RE: PHp
PHP identify how to evaluate two numbers or two text strings, but in a multidimensional array, each element is an array. PHP provides many utility to sort an array.

No Fee Work at Home | Data Entry | Work from home
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: